#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 | #64759289 | Utilizator | |
| Fișier | gustare.cpp | Dimensiune | 623 B |
| Data încărcării | 28 Mai 2026, 10:48 | Scor/rezultat | Eroare de compilare |
gustare.cpp:4:1: error: ‘iftream’ does not name a type 4 | iftream f("gustare.in"); | ^~~~~~~ gustare.cpp:6:5: error: expected ‘,’ or ‘;’ before ‘int’ 6 | int v1[50001],v2[50011],v3[50001],n,m,i,k,j,t,s,ok; | ^~~ gustare.cpp: In function ‘int main()’: gustare.cpp:8:2: error: ‘f’ was not declared in this scope 8 | {f>>n; | ^ gustare.cpp:8:5: error: ‘n’ was not declared in this scope 8 | {f>>n; | ^ gustare.cpp:9:6: error: ‘i’ was not declared in this scope 9 | for(i=1;i<=n;i++) | ^ gustare.cpp:10:9: error: ‘v1’ was not declared in this scope 10 | f>>v1[i]; | ^~ gustare.cpp:11:5: error: ‘m’ was not declared in this scope; did you mean ‘tm’? 11 | f>>m; | ^ | tm gustare.cpp:12:6: error: ‘j’ was not declared in this scope 12 | for(j=1;<=m;j++) | ^ gustare.cpp:12:10: error: expected primary-expression before ‘<=’ token 12 | for(j=1;<=m;j++) | ^~ gustare.cpp:13:9: error: ‘v2’ was not declared in this scope 13 | f>>v2[j]; | ^~ gustare.cpp:14:7: error: ‘v2’ was not declared in this scope 14 | sort(v2+1,v2+m+1); | ^~ gustare.cpp:14:2: error: ‘sort’ was not declared in this scope; did you mean ‘short’? 14 | sort(v2+1,v2+m+1); | ^~~~ | short gustare.cpp:15:5: error: ‘t’ was not declared in this scope; did you mean ‘tm’? 15 | f>>t; | ^ | tm gustare.cpp:16:6: error: ‘k’ was not declared in this scope 16 | for(k=1;k<=t;k++) | ^ gustare.cpp:19:7: error: ‘i’ was not declared in this scope 19 | for(i=1;i<=n&&!ok==0;i++) | ^ gustare.cpp:20:4: error: ‘s’ was not declared in this scope 20 | {s=x-v1[i]; | ^ gustare.cpp:20:6: error: ‘x’ was not declared in this scope 20 | {s=x-v1[i]; | ^ gustare.cpp:20:8: error: ‘v1’ was not declared in this scope 20 | {s=x-v1[i]; | ^~ gustare.cpp:22:5: error: ‘sr’ was not declared in this scope 22 | {sr=1,dr=m; | ^~ gustare.cpp:22:10: error: ‘dr’ was not declared in this scope 22 | {sr=1,dr=m; | ^~ gustare.cpp:23:11: error: ‘st’ was not declared in this scope; did you mean ‘std’? 23 | while(st<=dr) | ^~ | std gustare.cpp:24:6: error: ‘mij’ was not declared in this scope 24 | {mij=(st+dr)/2; | ^~~ gustare.cpp:32:15: error: expected ‘}’ at end of input 32 | return 0;} | ^ gustare.cpp:20:3: note: to match this ‘{’ 20 | {s=x-v1[i]; | ^ gustare.cpp:32:15: error: expected ‘}’ at end of input 32 | return 0;} | ^ gustare.cpp:17:2: note: to match this ‘{’ 17 | {f>>k; | ^ gustare.cpp:32:15: error: expected ‘}’ at end of input 32 | return 0;} | ^ gustare.cpp:8:1: note: to match this ‘{’ 8 | {f>>n; | ^
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ă.