#4265
Se dă un șir v1, v2, …, vn de numere naturale nenule și de asemenea se dau două numere naturale nenule A și B. Să se determine numărul perechilor (vi , vj) cu i < j și A ≤ vi + vj ≤ B.
Folclorul informatic
| Problema | perechiAB | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64487797 | Utilizator | |
| Fișier | perechiab.cpp | Dimensiune | 704 B |
| Data încărcării | 10 Mai 2026, 19:20 | Scor/rezultat | Eroare de compilare |
perechiab.cpp: In function ‘int main()’: perechiab.cpp:5:1: error: ‘lonf’ was not declared in this scope; did you mean ‘long’? 5 | lonf long n,st,dr,mij,x,val,poz1,poz2,nr,a,b; | ^~~~ | long perechiab.cpp:6:6: error: ‘n’ was not declared in this scope; did you mean ‘yn’? 6 | cin>>n; | ^ | yn perechiab.cpp:8:5: error: ‘x’ was not declared in this scope 8 | for(x=1;x<=n;x++) | ^ perechiab.cpp:10:6: error: ‘v’ was not declared in this scope 10 | cin>>v[x]; | ^ perechiab.cpp:12:6: error: ‘a’ was not declared in this scope 12 | cin>>a>>b; | ^ perechiab.cpp:12:9: error: ‘b’ was not declared in this scope 12 | cin>>a>>b; | ^ perechiab.cpp:13:6: error: ‘v’ was not declared in this scope 13 | sort(v+1,v+n+1); | ^ perechiab.cpp:14:1: error: ‘nr’ was not declared in this scope 14 | nr=0; | ^~ perechiab.cpp:15:5: error: ‘x’ was not declared in this scope 15 | for(x=1;x<=n;x++) | ^ perechiab.cpp:17:1: error: ‘st’ was not declared in this scope; did you mean ‘std’? 17 | st=x+1; | ^~ | std perechiab.cpp:18:1: error: ‘dr’ was not declared in this scope 18 | dr=n; | ^~ perechiab.cpp:19:1: error: ‘mij’ was not declared in this scope 19 | mij=(st+dr)/2; | ^~~ perechiab.cpp:20:1: error: ‘val’ was not declared in this scope 20 | val=a-v[x]; | ^~~ perechiab.cpp:27:17: error: ‘poz1’ was not declared in this scope 27 | if(v[mij]==val) poz1=mij; | ^~~~ perechiab.cpp:28:22: error: ‘poz1’ was not declared in this scope 28 | else if(v[mij]!=val) poz1=st; | ^~~~ perechiab.cpp:39:17: error: ‘poz2’ was not declared in this scope 39 | if(v[mij]==val) poz2=mij; | ^~~~ perechiab.cpp:40:22: error: ‘poz2’ was not declared in this scope 40 | else if(v[mij]!=val) poz2=dr; | ^~~~ perechiab.cpp:41:5: error: ‘poz2’ was not declared in this scope 41 | nr+=poz2-poz1+1; | ^~~~ perechiab.cpp:41:10: error: ‘poz1’ was not declared in this scope 41 | nr+=poz2-poz1+1; | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema perechiAB 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ă.