#503
Alternanta
Un vector cu elemente 0
sau 1
se numește alternativ dacă oricum am lua două elemente vecine în vector, cel puțin unul dintre ele este 0
.
Se dă un vector cu n
elemente, numere naturale. Verificați dacă vectorul este alternativ.
Problema | Alternanta | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54460177 | Utilizator | |
Fișier | alternanta.cpp | Dimensiune | 3.14 KB |
Data încărcării | 29 Noiembrie 2024, 06:36 | Scor / rezultat | Eroare de compilare |
alternanta.cpp: In function 'int main()': alternanta.cpp:23:28: error: 'INT_MAX' was not declared in this scope int n,i,c=0,d,aux,k=0,mini=INT_MAX,uc,y,z=0,maxi=INT_MINI,cmmdc,y,r; ^ alternanta.cpp:53:33: error: 'uc' was not declared in this scope while(aux!=0){uc=aux%10; ^ alternanta.cpp:62:19: error: 'y' was not declared in this scope y=0; ^ alternanta.cpp:63:33: error: 'uc' was not declared in this scope while(aux!=0){uc=aux%10; ^ alternanta.cpp:66:31: error: 'z' was not declared in this scope if(y==v[i]) z++; ^ alternanta.cpp:68:22: error: 'z' was not declared in this scope if(z!=0) cout<<y; ^ alternanta.cpp:68:35: error: 'y' was not declared in this scope if(z!=0) cout<<y; ^ alternanta.cpp:72:38: error: 'r' was not declared in this scope if(v[i]<mini){mini=r;} ^ alternanta.cpp:73:32: error: 'maxi' was not declared in this scope else if(v[i]>maxi){maxi=y;} ^ alternanta.cpp:73:43: error: 'y' was not declared in this scope else if(v[i]>maxi){maxi=y;} ^ alternanta.cpp:74:25: error: 'y' was not declared in this scope while(y!=0){r=x%y; ^ alternanta.cpp:74:31: error: 'r' was not declared in this scope while(y!=0){r=x%y; ^ alternanta.cpp:74:33: error: 'x' was not declared in this scope while(y!=0){r=x%y; ^ alternanta.cpp:77:19: error: 'cmmdc' was not declared in this scope cmmdc=v[i]; ^ alternanta.cpp:24:11: warning: unused variable 'oki' [-Wunused-variable] bool ok=1,oki; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Alternanta 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ă.