Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
为啥我的错了,报的编译错误,本地都是对(+_+)?(求大佬回复)#include<iostream> #include<vector> using namespace std; typedef long long LL; const int NN = 1e6; bool isPrime[NN]; vector<int> Primes; void sieve() { fill_n(isPrime, NN, true); for (LL i = 2; i < NN; i++) { if (!isPrime[i]) continue; Primes.push_back(i); for (LL j = i * i; j < NN; j += i) isPrime[j] = false; } } int main() { ios::sync_with_stdio(false), cin.tie(0); sieve(); for (int n; cin >> n && n;) { for (int p : Primes) { if (isPrime[n - p]) { printf("%d = %d + %d\n", n, p, n - p); break; } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator