#1126
Betisoare
Se presupune că unele dintre primele instrumente de calcul au fost beţişoarele de socotit. În problema noastră vom considera un număr ca fiind o succesiune de unul sau mai multe beţişoare, un beţişor fiind reprezentat de litera I
. Într-o expresie, între oricare două numere există semnul +
sau semnul *
.
Exemple de numere
I III IIIIIIIIIII
Exemple de expresii
III II*III I+I*III+IIIIIII
Scrieţi un program care evaluează astfel de expresii.
ONI GIM 2014, Clasa a VI-a
Problema | Betisoare | Operații I/O |
betisoare.in /betisoare.out
|
---|---|---|---|
Limita timp | 1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #52779706 | Utilizator | |
Fișier | betisoare.cpp | Dimensiune | 1.64 KB |
Data încărcării | 09 Octombrie 2024, 11:25 | Scor / rezultat | Eroare de compilare |
betisoare.cpp: In function 'int main()': betisoare.cpp:8:5: error: 'usigned' was not declared in this scope usigned long long int n, nr1=0, nr2=0, nr3=0, op1=0, op2=0, ok=0; ^ betisoare.cpp:8:13: error: expected ';' before 'long' usigned long long int n, nr1=0, nr2=0, nr3=0, op1=0, op2=0, ok=0; ^ betisoare.cpp:10:12: error: 'n' was not declared in this scope cin >> n; ^ betisoare.cpp:14:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0; i<s.size(); i++) ^ betisoare.cpp:16:16: error: 'ok' was not declared in this scope if(ok==0) ^ betisoare.cpp:18:36: error: 'nr1' was not declared in this scope while(s[i]=='I') { nr1++; i++; } ^ betisoare.cpp:19:31: error: 'op1' was not declared in this scope if(s[i]=='+') op1=1; ^ betisoare.cpp:20:22: error: 'op1' was not declared in this scope else op1=2; ^ betisoare.cpp:25:36: error: 'nr2' was not declared in this scope while(s[i]=='I') { nr2++; i++; } ^ betisoare.cpp:26:31: error: 'op2' was not declared in this scope if(s[i]=='+') op2=1; ^ betisoare.cpp:27:22: error: 'op2' was not declared in this scope else op2=2; ^ betisoare.cpp:32:36: error: 'nr3' was not declared in this scope while(s[i]=='I') { nr3++; i++; } ^ betisoare.cpp:33:20: error: 'op1' was not declared in this scope if(op1==1 && op2==1) ^ betisoare.cpp:33:30: error: 'op2' was not declared in this scope if(op1==1 && op2==1) ^ betisoare.cpp:35:21: error: 'nr1' was not declared in this scope nr1=nr1+nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:35:29: error: 'nr2' was not declared in this scope nr1=nr1+nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:35:38: error: 'nr3' was not declared in this scope nr1=nr1+nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:39:21: error: 'nr2' was not declared in this scope nr2=nr2*nr3; nr3=0; ^ betisoare.cpp:39:29: error: 'nr3' was not declared in this scope nr2=nr2*nr3; nr3=0; ^ betisoare.cpp:43:21: error: 'nr1' was not declared in this scope nr1=nr1*nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:43:29: error: 'nr2' was not declared in this scope nr1=nr1*nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:43:38: error: 'nr3' was not declared in this scope nr1=nr1*nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:47:21: error: 'nr1' was not declared in this scope nr1=nr1*nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:47:29: error: 'nr2' was not declared in this scope nr1=nr1*nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:47:38: error: 'nr3' was not declared in this scope nr1=nr1*nr2; nr2=nr3; nr3=0; op1=op2; ^ betisoare.cpp:49:31: error: 'op2' was not declared in this scope if(s[i]=='+') op2=1; ^ betisoare.cpp:50:22: error: 'op2' was not declared in this scope else op2=2; ^ betisoare.cpp:53:12: error: 'nr2' was not declared in this scope if(nr2!=0) ^ betisoare.cpp:55:16: error: 'op1' was not declared in this scope if(op1==1) nr1=nr1+nr2; ^ betisoare.cpp:55:24: error: 'nr1' was not declared in this scope if(op1==1) nr1=nr1+nr2; ^ betisoare.cpp:56:18: error: 'nr1' was not declared in this scope else nr1=nr1*nr2; ^ betisoare.cpp:58:17: error: 'nr1' was not declared in this scope cout << nr1 << endl; ^ betisoare.cpp:59:16: error: 'nr2' was not declared in this scope nr1=0; nr2=0; nr3=0; op1=0; op2=0; ok=0; ^ betisoare.cpp:59:23: error: 'nr3' was not declared in this scope nr1=0; nr2=0; nr3=0; op1=0; op2=0; ok=0; ^ betisoare.cpp:59:30: error: 'op1' was not declared in this scope nr1=0; nr2=0; nr3=0; op1=0; op2=0; ok=0; ^ betisoare.cpp:59:37: error: 'op2' was not declared in this scope nr1=0; nr2=0; nr3=0; op1=0; op2=0; ok=0; ^ betisoare.cpp:59:44: error: 'ok' was not declared in this scope nr1=0; nr2=0; nr3=0; op1=0; op2=0; ok=0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Betisoare 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ă.