#742
Numar2
Fie un număr natural a
având n
cifre. Scrieţi un program care să determine un număr natural x
cu proprietatea că este cel mai mic număr mai mare decât a
, care are exact aceleaşi cifre ca şi numărul a
.
Problema | Numar2 | Operații I/O |
numar2.in /numar2.out
|
---|---|---|---|
Limita timp | 2 secunde | Limita memorie |
Total: 2 MB
/
Stivă 2 MB
|
Id soluție | #52407292 | Utilizator | |
Fișier | numar2.cpp | Dimensiune | 798 B |
Data încărcării | 29 Septembrie 2024, 14:53 | Scor / rezultat | Eroare de compilare |
numar2.cpp:3:13: error: too many decimal points in number c:array[0..9] of longint; ^ numar2.cpp:9:11: warning: character constant too long for its type [enabled by default] assign(f,'numar2.in'); reset(f); ^ numar2.cpp:10:11: warning: character constant too long for its type [enabled by default] assign(g,'numar2.out'); rewrite(g); ^ numar2.cpp:1:1: error: 'var' does not name a type var f,g:text; ^ numar2.cpp:2:5: error: 'n' does not name a type n,i,j,k:longint; ^ numar2.cpp:3:6: error: found ':' in nested-name-specifier, expected '::' c:array[0..9] of longint; ^ numar2.cpp:3:5: error: 'c' does not name a type c:array[0..9] of longint; ^ numar2.cpp:4:8: error: found ':' in nested-name-specifier, expected '::' poz:longint; ^ numar2.cpp:4:5: error: 'poz' does not name a type poz:longint; ^ numar2.cpp:5:5: error: 'cif' does not name a type cif,a,b:byte; ^ numar2.cpp:6:5: error: 'buf' does not name a type buf:char; ^ numar2.cpp:8:1: error: 'begin' does not name a type begin ^ numar2.cpp:9:30: error: expected constructor, destructor, or type conversion before '(' token assign(f,'numar2.in'); reset(f); ^ numar2.cpp:10:8: error: expected constructor, destructor, or type conversion before '(' token assign(g,'numar2.out'); rewrite(g); ^ numar2.cpp:10:33: error: expected constructor, destructor, or type conversion before '(' token assign(g,'numar2.out'); rewrite(g); ^ numar2.cpp:11:8: error: expected constructor, destructor, or type conversion before '(' token readln(f,n); ^ numar2.cpp:12:2: error: 'poz' does not name a type poz := 0; ^ numar2.cpp:13:6: error: expected constructor, destructor, or type conversion before '(' token read(f,buf); ^ numar2.cpp:14:2: error: 'a' does not name a type a := ord(buf) - 48; ^ numar2.cpp:15:5: error: expected constructor, destructor, or type conversion before '(' token inc(c[a]); ^ numar2.cpp:16:2: error: expected unqualified-id before 'for' for i := 2 to n do ^ numar2.cpp:19:4: error: 'b' does not name a type b := ord(buf) - 48; ^ numar2.cpp:20:4: error: expected unqualified-id before 'if' if a>=b then inc(c[b]) ^ numar2.cpp:24:7: error: expected unqualified-id before 'for' for j := 0 to 9 do c[j]:=0; ^ numar2.cpp:25:10: error: expected constructor, destructor, or type conversion before '(' token inc(c[b]); ^ numar2.cpp:26:7: error: 'cif' does not name a type cif := a; ^ numar2.cpp:27:5: error: 'end' does not name a type end; ^ numar2.cpp:28:4: error: 'a' does not name a type a := b; ^ numar2.cpp:29:3: error: 'end' does not name a type end; ^ numar2.cpp:30:7: error: expected constructor, destructor, or type conversion before '(' token reset(f); ^ numar2.cpp:31:8: error: expected constructor, destructor, or type conversion before '(' token readln(f,n); ^ numar2.cpp:32:2: error: expected unqualified-id before 'for' for i := 1 to poz-1 do ^ numar2.cpp:35:9: error: expected constructor, destructor, or type conversion before '(' token write(g,buf) ^ numar2.cpp:37:2: error: expected unqualified-id before 'for' for j := cif+1 to 9 do ^ numar2.cpp:41:10: error: expected constructor, destructor, or type conversion before '(' token dec(c[j]); ^ numar2.cpp:42:7: error: expected unqualified-id before 'break' break ^ numar2.cpp:44:5: error: expected constructor, destructor, or type conversion before '(' token inc(c[cif]); ^ numar2.cpp:45:2: error: expected unqualified-id before 'for' for j := 0 to 9 do ^ numar2.cpp:48:9: error: expected constructor, destructor, or type conversion before '(' token writeln(g); ^ numar2.cpp:49:7: error: expected constructor, destructor, or type conversion before '(' token close(g); ^ numar2.cpp:50:1: error: 'end' does not name a type end. ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Numar2 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ă.