首页 > 代码库 > 【BZOJ】3850: ZCC Loves Codefires(300T就这样献给了水题TAT)
【BZOJ】3850: ZCC Loves Codefires(300T就这样献给了水题TAT)
http://www.lydsy.com/JudgeOnline/problem.php?id=3850
题意:类似国王游戏....无意义..
#include <cstdio>#include <cstring>#include <cmath>#include <string>#include <iostream>#include <algorithm>#include <queue>#include <set>#include <map>#include <sstream>using namespace std;typedef long long ll;#define pb push_back#define rep(i, n) for(int i=0; i<(n); ++i)#define for1(i,a,n) for(int i=(a);i<=(n);++i)#define for2(i,a,n) for(int i=(a);i<(n);++i)#define for3(i,a,n) for(int i=(a);i>=(n);--i)#define for4(i,a,n) for(int i=(a);i>(n);--i)#define CC(i,a) memset(i,a,sizeof(i))#define read(a) a=getint()#define print(a) printf("%d", a)#define dbg(x) cout << (#x) << " = " << (x) << endl#define error(x) (!(x)?puts("error"):0)#define rdm(x, i) for(int i=ihead[x]; i; i=e[i].next)inline int getint() { static int r, k; r=0,k=1; static char c; c=getchar(); for(; c<‘0‘||c>‘9‘; c=getchar()) if(c==‘-‘) k=-1; for(; c>=‘0‘&&c<=‘9‘; c=getchar()) r=r*10+c-‘0‘; return k*r; }const int N=1e5+10;struct dat { int x, y; }a[N];ll ans;int n;bool cmp(const dat &a, const dat &b) { return a.y*a.x+b.y*(a.x+b.x)<b.y*b.x+a.y*(a.x+b.x); }int main() { read(n); rep(i, n) read(a[i].x); rep(i, n) read(a[i].y); sort(a, a+n, cmp); ll sum=0; rep(i, n) sum+=a[i].x, ans+=sum*a[i].y; cout << ans; return 0;}
300T就这样献给了这种水题TAT..
【BZOJ】3850: ZCC Loves Codefires(300T就这样献给了水题TAT)
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。