#2086
SCLMprime
Se consideră un șir cu n
numere naturale. Determinați cel mai lung subșir crescător al șirului, cu proprietatea că toate elementele subșirului sunt numere prime. Dacă există mai multe subșiruri de lungime maximă se va afișa subșirul minim lexicografic.
Problema | SCLMprime | Operații I/O |
sclmprime.in /sclmprime.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54725754 | Utilizator | |
Fișier | sclmprime.cpp | Dimensiune | 2.31 KB |
Data încărcării | 06 Decembrie 2024, 13:38 | Scor / rezultat | Eroare de compilare |
sclmprime.cpp: In function 'int main()': sclmprime.cpp:56:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(v[i]>=v[j] && l[j]+1>l[i] || (l[i]==l[j]+1 && v[j]<v[pred[i]])) ^ sclmprime.cpp:61:42: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(l[i]>l[imax] || l[imax]==l[i] && v[imax]>v[i]) ^ sclmprime.cpp: At global scope: sclmprime.cpp:71:12: error: redefinition of 'std::ifstream in' ifstream in("sclmprime.in"); ^ sclmprime.cpp:4:10: error: 'std::ifstream in' previously declared here ifstream in("sclmprime.in"); ^ sclmprime.cpp:72:13: error: redefinition of 'std::ofstream out' ofstream out("sclmprime.out"); ^ sclmprime.cpp:5:10: error: 'std::ofstream out' previously declared here ofstream out("sclmprime.out"); ^ sclmprime.cpp:74:5: error: redefinition of 'int n' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:5: error: 'int n' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:13: error: redefinition of 'int v [1001]' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:7: error: 'int v [1001]' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:15: error: redefinition of 'int i' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:15: error: 'int i' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:17: error: redefinition of 'int imax' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:17: error: 'int imax' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:28: error: redefinition of 'int l [1001]' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:22: error: 'int l [1001]' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:39: error: redefinition of 'int pred [1001]' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:30: error: 'int pred [1001]' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:41: error: redefinition of 'int j' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:41: error: 'int j' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:43: error: redefinition of 'int m' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:43: error: 'int m' previously defined here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:74:47: error: redefinition of 'int x' int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp:7:47: error: 'int x' previously declared here int n,v[1001],i,imax,l[1001],pred[1001],j,m=0,x; ^ sclmprime.cpp: In function 'void afisare(int)': sclmprime.cpp:75:6: error: redefinition of 'void afisare(int)' void afisare(int i) ^ sclmprime.cpp:8:6: error: 'void afisare(int)' previously defined here void afisare(int i) ^ sclmprime.cpp: In function 'int prim(int)': sclmprime.cpp:85:5: error: redefinition of 'int prim(int)' int prim (int n) ^ sclmprime.cpp:18:5: error: 'int prim(int)' previously defined here int prim (int n) ^ sclmprime.cpp: In function 'int main()': sclmprime.cpp:104:5: error: redefinition of 'int main()' int main() ^ sclmprime.cpp:37:5: error: 'int main()' previously defined here int main() ^ sclmprime.cpp:123:27: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(v[i]>=v[j] && l[j]+1>l[i] || (l[i]==l[j]+1 && v[j]<v[pred[i]])) ^ sclmprime.cpp:128:42: warning: suggest parentheses around '&&' within '||' [-Wparentheses] if(l[i]>l[imax] || l[imax]==l[i] && v[imax]>v[i]) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema SCLMprime 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ă.