Search found 2 matches

by Ar Anik
Sun Jun 23, 2019 6:05 am
Forum: Volume 4 (400-499)
Topic: Uva 406 Why I get Wrong Answer
Replies: 0
Views: 142

Uva 406 Why I get Wrong Answer

#include<bits/stdc++.h> using namespace std; #define N 2000 int p[N+1]; vector<int>a; void prime() { int i, j, l; l = sqrt(N); p[0] = 1; a.push_back(1); a.push_back(2); for(i=4; i<=N; i+=2) p = 1; for(i=3; i<=N; i+=2) { if(p == 0) { a.push_back(i); if(i<=l) { for(j=i*i; j<=N; j+=i*2) p[j] = 1; } } }...
by Ar Anik
Sun Jun 23, 2019 6:01 am
Forum: Volume 4 (400-499)
Topic: Why i get WA...........Plz Help
Replies: 0
Views: 56

Why i get WA...........Plz Help

#include<bits/stdc++.h> using namespace std; #define N 2000 int p[N+1]; vector<int>a; void prime() { int i, j, l; l = sqrt(N); p[0] = 1; a.push_back(1); a.push_back(2); for(i=4; i<=N; i+=2) p = 1; for(i=3; i<=N; i+=2) { if(p == 0) { a.push_back(i); if(i<=l) { for(j=i*i; j<=N; j+=i*2) p[j] = 1; } } }...

Go to advanced search