标签:col char namespace return turn sig for amp ||
CodeForces - 1201B
首先和是偶数,最大的数要小于总和的一半
#include <iostream> #include <cstdio> #include <queue> #include <algorithm> #include <cmath> #include <cstring> #define inf 2147483647 #define N 1000010 #define p(a) putchar(a) #define For(i,a,b) for(long long i=a;i<=b;++i) //by war //2020.2.10 using namespace std; long long n,ans; long long a[N]; void in(long long &x){ long long y=1;char c=getchar();x=0; while(c<‘0‘||c>‘9‘){if(c==‘-‘)y=-1;c=getchar();} while(c<=‘9‘&&c>=‘0‘){ x=(x<<1)+(x<<3)+c-‘0‘;c=getchar();} x*=y; } void o(long long x){ if(x<0){p(‘-‘);x=-x;} if(x>9)o(x/10); p(x%10+‘0‘); } signed main(){ in(n); For(i,1,n){ in(a[i]); ans+=a[i]; } sort(a+1,a+n+1); if(ans%2==0&&a[n]<=ans/2) puts("YES"); else puts("NO"); return 0; }
标签:col char namespace return turn sig for amp ||
原文地址:https://www.cnblogs.com/war1111/p/12292288.html