#1082
Triunghi3
Se consideră un triunghi alcătuit din numere naturale scrise pe n
linii ca în figura alăturată. Liniile triunghiului sunt numerotate de la 1
la n
, începând cu linia de la baza triunghiului (linia de jos), iar poziţiile pe linie sunt numerotate începând cu 1
de la stânga la dreapta.
Fiecare număr din triunghi, exceptând pe cele de pe linia 1
, este egal cu suma numerelor aflate imediat sub el, în stânga şi respectiv în dreapta lui.
Cunoscând câte un număr de pe fiecare linie a triunghiului, determinaţi toate numerele de pe linia 1
.
OJI 2012, Clasa a VII-a
Problema | Triunghi3 | Operații I/O |
triunghi3.in /triunghi3.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 20 MB
/
Stivă 8 MB
|
Id soluție | #51874063 | Utilizator | |
Fișier | triunghi3.cpp | Dimensiune | 552 B |
Data încărcării | 02 Septembrie 2024, 12:27 | Scor / rezultat | Eroare de compilare |
triunghi3.cpp:1:1: error: stray '\302' in program #include <fstream> ^ triunghi3.cpp:1:1: error: stray '\240' in program triunghi3.cpp:1:3: error: stray '#' in program #include <fstream> ^ triunghi3.cpp:15:1: error: stray '\302' in program f>>n; ^ triunghi3.cpp:15:1: error: stray '\240' in program triunghi3.cpp:17:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ triunghi3.cpp:17:1: error: stray '\240' in program triunghi3.cpp:19:1: error: stray '\302' in program { ^ triunghi3.cpp:19:1: error: stray '\240' in program triunghi3.cpp:21:1: error: stray '\302' in program f>>p[n-i+1]; ^ triunghi3.cpp:21:1: error: stray '\240' in program triunghi3.cpp:21:1: error: stray '\302' in program triunghi3.cpp:21:1: error: stray '\240' in program triunghi3.cpp:24:1: error: stray '\302' in program a[n-i+1][p[n-i+1]]=v; ^ triunghi3.cpp:24:1: error: stray '\240' in program triunghi3.cpp:24:1: error: stray '\302' in program triunghi3.cpp:24:1: error: stray '\240' in program triunghi3.cpp:26:1: error: stray '\302' in program } ^ triunghi3.cpp:26:1: error: stray '\240' in program triunghi3.cpp:28:1: error: stray '\302' in program ct=1; ^ triunghi3.cpp:28:1: error: stray '\240' in program triunghi3.cpp:30:1: error: stray '\302' in program for(i=2;i<=n;i++) ^ triunghi3.cpp:30:1: error: stray '\240' in program triunghi3.cpp:32:1: error: stray '\302' in program { ^ triunghi3.cpp:32:1: error: stray '\240' in program triunghi3.cpp:34:1: error: stray '\302' in program ct++; ^ triunghi3.cpp:34:1: error: stray '\240' in program triunghi3.cpp:34:1: error: stray '\302' in program triunghi3.cpp:34:1: error: stray '\240' in program triunghi3.cpp:36:1: error: stray '\302' in program for(z=p[i]+1;z<=ct;z++) ^ triunghi3.cpp:36:1: error: stray '\240' in program triunghi3.cpp:36:1: error: stray '\302' in program triunghi3.cpp:36:1: error: stray '\240' in program triunghi3.cpp:36:1: error: stray '\302' in program triunghi3.cpp:36:1: error: stray '\240' in program triunghi3.cpp:38:1: error: stray '\302' in program a[i][z]=a[i-1][z-1]-a[i][z-1]; ^ triunghi3.cpp:38:1: error: stray '\240' in program triunghi3.cpp:38:1: error: stray '\302' in program triunghi3.cpp:38:1: error: stray '\240' in program triunghi3.cpp:38:1: error: stray '\302' in program triunghi3.cpp:38:1: error: stray '\240' in program triunghi3.cpp:38:1: error: stray '\302' in program triunghi3.cpp:38:1: error: stray '\240' in program triunghi3.cpp:40:1: error: stray '\302' in program for(z=p[i]-1;z>=1;z--) ^ triunghi3.cpp:40:1: error: stray '\240' in program triunghi3.cpp:40:1: error: stray '\302' in program triunghi3.cpp:40:1: error: stray '\240' in program triunghi3.cpp:40:1: error: stray '\302' in program triunghi3.cpp:40:1: error: stray '\240' in program triunghi3.cpp:42:1: error: stray '\302' in program a[i][z]=a[i-1][z]-a[i][z+1]; ^ triunghi3.cpp:42:1: error: stray '\240' in program triunghi3.cpp:42:1: error: stray '\302' in program triunghi3.cpp:42:1: error: stray '\240' in program triunghi3.cpp:42:1: error: stray '\302' in program triunghi3.cpp:42:1: error: stray '\240' in program triunghi3.cpp:42:1: error: stray '\302' in program triunghi3.cpp:42:1: error: stray '\240' in program triunghi3.cpp:45:1: error: stray '\302' in program } ^ triunghi3.cpp:45:1: error: stray '\240' in program triunghi3.cpp:48:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ triunghi3.cpp:48:1: error: stray '\240' in program triunghi3.cpp:50:1: error: stray '\302' in program g<<a[n][i]<<" "; ^ triunghi3.cpp:50:1: error: stray '\240' in program triunghi3.cpp:50:1: error: stray '\302' in program triunghi3.cpp:50:1: error: stray '\240' in program triunghi3.cpp:1:4: error: 'include' does not name a type #include <fstream> ^ triunghi3.cpp:5:1: error: 'ifstream' does not name a type ifstream f("triunghi3.in"); ^ triunghi3.cpp:7:1: error: 'ofstream' does not name a type ofstream g("triunghi3.out"); ^ triunghi3.cpp: In function 'int main()': triunghi3.cpp:15:3: error: 'f' was not declared in this scope f>>n; ^ triunghi3.cpp:50:5: error: 'g' was not declared in this scope g<<a[n][i]<<" "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Triunghi3 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ă.