HDU 5150 Sum Sum Sum
Chieh
posted @ 2014年12月27日 21:29
in BestCoder
, 266 阅读
链接 http://acm.hdu.edu.cn/showproblem.php?pid=5150
Bestcoder的一道题。。。直接暴力即可。。。但是看见被hack的好多。。。原来是在1这里出了问题。。。后面几个题没几个做的出来。看来这场的题偏难了
/* Author:Chieh Grow up happy */ #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #include <queue> #include <map> #include <stack> #include <vector> #define LL long long using namespace std; const int maxn=1234; int n; int ai[maxn]; int bi[maxn]; void init() { for(int i=1; i<=n; i++)scanf("%d",&bi[i]); } void play() { int over=0; for(int i=1; i<=n; i++) { if(!ai[bi[i]])over+=bi[i]; } printf("%d\n",over); } int main() { memset(ai,0,sizeof(ai)); for(int i=1; i<=1000; i++) { for(int j=2; j<i; j++) { if(i%j==0)ai[i]=1; } } while(scanf("%d",&n)!=EOF) { init(); play(); } return 0; }
2018年10月12日 22:21
This new phone cover is really impressive and innovative. My own phone has accidentally dropped from me many times. This one is totally sick. Thanks for sharing this amazing article with us. Keep posting.