#2330
prim023
Dorel a scris un şir format din n
numere naturale nenule. Apoi a luat fiecare subşir şi a calculat produsul termenilor săi. Aflaţi câte dintre produsele efectuate sunt numere prime.
Problema | prim023 | Operații I/O |
prim023.in /prim023.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53777031 | Utilizator | |
Fișier | prim023.cpp | Dimensiune | 899 B |
Data încărcării | 11 Noiembrie 2024, 15:06 | Scor / rezultat | Eroare de compilare |
prim023.cpp:3:1: error: stray '\342' in program ifstream cin(“prim023.in”); ^ prim023.cpp:3:1: error: stray '\200' in program prim023.cpp:3:1: error: stray '\234' in program prim023.cpp:3:1: error: stray '\342' in program prim023.cpp:3:1: error: stray '\200' in program prim023.cpp:3:1: error: stray '\235' in program prim023.cpp:4:1: error: stray '\342' in program ofstream cout(“prim023.out”); ^ prim023.cpp:4:1: error: stray '\200' in program prim023.cpp:4:1: error: stray '\234' in program prim023.cpp:4:1: error: stray '\342' in program prim023.cpp:4:1: error: stray '\200' in program prim023.cpp:4:1: error: stray '\235' in program prim023.cpp:7:1: error: stray '\302' in program { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:1: error: stray '\251' in program prim023.cpp:7:1: error: stray '\342' in program prim023.cpp:7:1: error: stray '\200' in program prim023.cpp:7:1: error: stray '\224' in program prim023.cpp:7:1: error: stray '\342' in program prim023.cpp:7:1: error: stray '\200' in program prim023.cpp:7:1: error: stray '\224' in program prim023.cpp:3:17: error: 'prim023' was not declared in this scope ifstream cin(“prim023.in”); ^ prim023.cpp:4:18: error: 'prim023' was not declared in this scope ofstream cout(“prim023.out”); ^ prim023.cpp: In function 'int prim(int)': prim023.cpp:7:8: error: expected ')' before numeric constant { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:33: error: expected ')' before numeric constant { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:55: error: expected ')' before numeric constant { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:84: error: 'prime' was not declared in this scope { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:145: error: expected ')' before numeric constant { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp: In function 'int main()': prim023.cpp:7:274: error: 'E' was not declared in this scope { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:320: error: 'E' was not declared in this scope { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:325: error: expected ')' before numeric constant { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:330: error: 'prime' was not declared in this scope { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:492: error: incompatible types in assignment of 'int' to 'int [10001]' { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:521: warning: statement has no effect [-Wunused-value] { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^ prim023.cpp:7:706: warning: for increment expression has no effect [-Wunused-value] { if(n 0 || n 1) return 0; if(n 2) return 1; if(n % 2 0) return 0; for(int i = 1 ; prime[i] * prime[i] <= n && i <= nrp ; i ++) if(n % prime[i] 0) return 0; return 1; } int main() { int n , cnt = 0 , p = 0 , x , c = 1 , a[10001]; cin >> n; for(int i = 2 ; i < 35000 ; i++) E[i] = 1; for(int i = 2 ; i < 35000 ; i++) if(E[i] 1) { prime[ ++ nrp] = i; for(int j = i * i; j < 35000; j += i) E[j] = 0; } for(int i = 0 ; i < n ; ++i) { cin >> x; if(prim(x)) cnt++; if(x==1) p++; } while(cnt) { a©=cnt%10; c++; cnt/=10; } c—; for(int i = 1; i <= p ; i++) { int t = 0; for(int j = 1; j <= c ; j++) { int cif=a[j]*2+t; a[j] = cif % 10; t=cif/10; } while(t) { a[++c]=t%10; t/=10; } } for(int i = c ; i >= 1 ; —i) cout << a[i]; if(c==0)cout << c; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema prim023 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.