#2702
Andrei lucrează într-un magazin de șosete, iar fiecare șosetă are asociat un numar întreg pentru a o identifica mai ușor din ce model face parte. Dându-se un vector neordonat de astfel de coduri, aflați câte perechi de șosete se pot forma.
hackerrank.com
| Problema | PerechiSosete | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64330940 | Utilizator | |
| Fișier | perechisosete.cpp | Dimensiune | 314 B |
| Data încărcării | 30 Aprilie 2026, 08:49 | Scor/rezultat | 0 puncte |
perechisosete.cpp: In function ‘int main()’: perechisosete.cpp:11:45: warning: iteration 99 invokes undefined behavior [-Waggressive-loop-optimizations] 11 | x[i]=-1; | ~~~~^~~ perechisosete.cpp:9:18: note: within this loop 9 | for(int i=1;i<101;i++) | ~^~~~ perechisosete.cpp:19:48: warning: iteration 99 invokes undefined behavior [-Waggressive-loop-optimizations] 19 | p=p+x[i]/2; | ~~~^ perechisosete.cpp:17:46: note: within this loop 17 | for(int i=1;i<101;i++) | ~^~~~ perechisosete.cpp:11:45: warning: ‘void* __builtin_memset(void*, int, long unsigned int)’ forming offset [400, 403] is out of the bounds [0, 400] of object ‘x’ with type ‘int [100]’ [-Warray-bounds=] 11 | x[i]=-1; | ~~~~^~~ perechisosete.cpp:7:9: note: ‘x’ declared here 7 | int x[100],n,r,p=0; | ^
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | Raspuns gresit. | 20 | 0 | Exemplu | |
| 2 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 20 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PerechiSosete 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ă.