Codeforces goodbye 2014 a
2015-01-06 00:00
183 查看
摘要: Codeforces goodbye 2014 a
#include <iostream> #include <fstream> #include <vector> #include <cstdio> #include <string> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; #ifdef DEBUG ifstream in; ofstream out; #endif #ifdef DEBUG #define CIN in #define COUT out #else #define CIN cin #define COUT cout #endif #define MAXN 1000 int table[MAXN + 10]; int n, ans, tmp; void build_table(void) { memset(table, 0, sizeof(table)); for(int i = 2; i <= 1000; i++){ for(int j = i; j <= 1000; j+= i) if(j > i) table[j] = 1; } } int main(void) { #ifdef DEBUG string buffer; CIN.open("in", ios::in); COUT.open("out", ios::out); while(getline(CIN, buffer)) COUT << buffer << "\n"; COUT << "Out Put" << "\n"; CIN.close(); CIN.open("in", ios::in); #endif build_table(); while(CIN >> n){ ans = 0; for(int i = 0; i < n; i++){ CIN >> tmp; if(!table[tmp]) ans += tmp; } COUT << ans << endl; } return 0; }
相关文章推荐
- Codeforces goodbye 2014 b
- codeforces GoodBye 2014 *A *B C(未完)
- Codeforces goodbye 2014 d
- Codeforces goodbye 2014
- codeforces goodbye2014
- Codeforces goodbye 2014 c
- Codeforces gym 100548 F (2014-2015 icpc西安现场赛) 数学
- 【转】Codeforces GoodBye2015 New Year and Three Musketeers Codeforces 611E(贪心)
- 【中途相遇法】【STL】BAPC2014 K Key to Knowledge (Codeforces GYM 100526)
- Codeforces GYM 100548 K - Last Defence 2014-2015 ACM-ICPC, Asia Xian Regional Contest
- Codeforces GoodBye 2015
- Codeforces Zepto Code Rush 2014 -C - Dungeons and Candies
- Codeforces Gym 100548G The Problem to Slow Down You (Palindromic Tree 或 Hash水过) 2014西安现场赛G题
- Codeforces April Fools Day Contest 2014(附官方题解)
- 2014-2015 CT S02E01: Codeforces Trainings Season 2 Episode 1 题解
- Codeforces GYM 100548 F - Color 2014-2015 ACM-ICPC, Asia Xian Regional Contest
- 【最短路】BAPC2014 B Button Bashing (Codeforces GYM 100526)
- Codeforces Rockethon 2014 解题报告
- Codeforces GYM 100548 I - International Collegiate Routing Contest 2014 ACM Xian Regional Contest
- 【最短路】BAPC2014 B Button Bashing (Codeforces GYM 100526)