Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

为啥我的错了,报的编译错误,本地都是对(+_+)?(求大佬回复)

Posted by lzy_Dennis at 2023-07-16 18:29:37 on Problem 2262 and last updated at 2023-07-17 18:50:25
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator