#4301
A venit ora mesei pentru Por Costel (masa dintre prânz și cină). Scormonind printr-o grădină, el descoperă un număr de N coceni de porumb și M mere. Masa lui Por Costel va consta în exact un cocean și un măr. Însă, mai nou, fanii săi l-au atenționat că trebuie să aibă grijă ce mănâncă. Fiecare cocean și fiecare măr are o valoare nutritivă. Valoarea nutritivă a mesei va fi valoarea nutritivă a coceanului ales + valoarea nutritiva a mărului ales. Dându-se valorile nutritive ale cocenilor și ale merelor, Por Costel vă întreabă dacă există o masă pe care o poate lua cu valoare nutritivă X. Pentru că Por Costel vrea sa mănânce de mai multe ori între prânz și cină, el va vă pune T întrebări de forma aceasta.
(Întrebările sunt independente între ele, a nu se considera că după o întrebare se elimină perechea cocean-mar aleasă).
Selecție pe școală, C.N. "Frații Buzești" - 2015, clasa a X-a
| Problema | gustare | Operații I/O |
gustare.in/gustare.out
|
|---|---|---|---|
| Limita timp | 0.4 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64702730 | Utilizator | |
| Fișier | gustare.cpp | Dimensiune | 673 B |
| Data încărcării | 25 Mai 2026, 08:43 | Scor/rezultat | Eroare de compilare |
gustare.cpp:3:1: error: ‘ifstream’ does not name a type 3 | ifstream f("gustare.in") | ^~~~~~~~ gustare.cpp: In function ‘int main()’: gustare.cpp:10:5: error: ‘f’ was not declared in this scope 10 | f>>n; | ^ gustare.cpp:10:8: error: ‘n’ was not declared in this scope 10 | f>>n; | ^ gustare.cpp:11:9: error: ‘i’ was not declared in this scope 11 | for(i=1;i<=n;i++) | ^ gustare.cpp:12:12: error: ‘v1’ was not declared in this scope 12 | f>>v1[i]; | ^~ gustare.cpp:13:8: error: ‘q’ was not declared in this scope 13 | f>>q; | ^ gustare.cpp:14:10: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 14 | f>>m; | ^ | tm gustare.cpp:15:9: error: ‘i’ was not declared in this scope 15 | for(i=1;i<=m;i++) | ^ gustare.cpp:16:12: error: ‘v2’ was not declared in this scope 16 | f>>v2[i]; | ^~ gustare.cpp:17:8: error: ‘t’ was not declared in this scope; did you mean ‘tm’? 17 | f>>t; | ^ | tm gustare.cpp:18:9: error: ‘k’ was not declared in this scope 18 | for(k=1;k<=t;k++) | ^ gustare.cpp:20:12: error: ‘x’ was not declared in this scope 20 | f>>x; | ^ gustare.cpp:21:9: error: ‘ok’ was not declared in this scope 21 | ok=0; | ^~ gustare.cpp:22:13: error: ‘i’ was not declared in this scope 22 | for(i=1;i<=n&&ok==0;i++) | ^ gustare.cpp:23:17: error: ‘j’ was not declared in this scope 23 | for(j=1;j<=m&&ok==0;j++) | ^ gustare.cpp:25:13: error: ‘s’ was not declared in this scope 25 | s=v1[i]+v2[j]; | ^ gustare.cpp:25:15: error: ‘v1’ was not declared in this scope 25 | s=v1[i]+v2[j]; | ^~ gustare.cpp:25:21: error: ‘v2’ was not declared in this scope 25 | s=v1[i]+v2[j]; | ^~ gustare.cpp:28:17: error: ‘g’ was not declared in this scope 28 | g<<"DA"<<endl; | ^ gustare.cpp:30:17: error: ‘g’ was not declared in this scope 30 | g<<"NU"<<endl; | ^ gustare.cpp: At global scope: gustare.cpp:34:5: error: expected unqualified-id before ‘return’ 34 | return 0; | ^~~~~~ gustare.cpp:35:1: error: expected declaration before ‘}’ token 35 | } | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema gustare 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ă.