#4964
Considerăm un număr natural X , cu cel puțin două cifre, toate diferite de 0 și un șir de N numere naturale, primul număr din șir fiind considerat pe poziția 1, al doilea pe poziția 2, al treilea pe poziția 3 ș.a.m.d.
Cerințe:
1. Determinați cel mai mare număr care se poate forma utilizând cifra unităților și cifra zecilor lui X.
2. Determinați poziția primei apariții a lui X în șirul celor N numere.
3. Determinați penultima și ultima poziție pe care apare X în șirul celor N numere.
4. Determinați numărul obținut prin inversarea ordinii de apariție a cifrelor impare din numărul X, fără a modifica pozițiile cifrelor pare. De exemplu, dacă X = 154372, se va obține numărul 734512.
OJI 2026, clasa a 5-a
| Problema | Numere32 | Operații I/O |
numere.in/numere.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64158601 | Utilizator | |
| Fișier | numere32.c | Dimensiune | 2.69 KB |
| Data încărcării | 20 Aprilie 2026, 22:47 | Scor/rezultat | 0 puncte |
numere32.c: In function ‘main’: numere32.c:34:18: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 34 | fscanf("%d",&cerinta); | ^~~~ | | | char * In file included from numere32.c:1: /usr/include/stdio.h:422:37: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:34:23: warning: passing argument 2 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 34 | fscanf("%d",&cerinta); | ^~~~~~~~ | | | int * /usr/include/stdio.h:423:43: note: expected ‘const char * restrict’ but argument is of type ‘int *’ 423 | const char *__restrict __format, ...) __wur __nonnull ((1)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:34:23: warning: format not a string literal and no format arguments [-Wformat-security] 34 | fscanf("%d",&cerinta); | ^~~~~~~~ numere32.c:36:18: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 36 | fscanf("%d",&x); | ^~~~ | | | char * /usr/include/stdio.h:422:37: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:36:23: warning: passing argument 2 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 36 | fscanf("%d",&x); | ^~ | | | int * /usr/include/stdio.h:423:43: note: expected ‘const char * restrict’ but argument is of type ‘int *’ 423 | const char *__restrict __format, ...) __wur __nonnull ((1)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:36:23: warning: format not a string literal and no format arguments [-Wformat-security] 36 | fscanf("%d",&x); | ^~ numere32.c:49:19: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types] 49 | fprintf("%d",rezultat1); | ^~~~ | | | char * In file included from /usr/include/stdio.h:980: /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:27: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:49:24: warning: passing argument 2 of ‘fprintf’ makes pointer from integer without a cast [-Wint-conversion] 49 | fprintf("%d",rezultat1); | ^~~~~~~~~ | | | int /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:60: note: expected ‘const char * restrict’ but argument is of type ‘int’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ numere32.c:49:11: warning: format not a string literal and no format arguments [-Wformat-security] 49 | fprintf("%d",rezultat1); | ^~~~~~~ numere32.c:57:20: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 57 | fscanf("%d",&n); | ^~~~ | | | char * /usr/include/stdio.h:422:37: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:57:25: warning: passing argument 2 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 57 | fscanf("%d",&n); | ^~ | | | int * /usr/include/stdio.h:423:43: note: expected ‘const char * restrict’ but argument is of type ‘int *’ 423 | const char *__restrict __format, ...) __wur __nonnull ((1)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:57:25: warning: format not a string literal and no format arguments [-Wformat-security] 57 | fscanf("%d",&n); | ^~ numere32.c:62:24: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 62 | fscanf("%d",&sir[i]); | ^~~~ | | | char * /usr/include/stdio.h:422:37: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:62:29: warning: passing argument 2 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 62 | fscanf("%d",&sir[i]); | ^~~~~~~ | | | int * /usr/include/stdio.h:423:43: note: expected ‘const char * restrict’ but argument is of type ‘int *’ 423 | const char *__restrict __format, ...) __wur __nonnull ((1)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:62:29: warning: format not a string literal and no format arguments [-Wformat-security] 62 | fscanf("%d",&sir[i]); | ^~~~~~~ numere32.c:71:21: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types] 71 | fprintf("%d",primaAparitieX); | ^~~~ | | | char * /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:27: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:71:26: warning: passing argument 2 of ‘fprintf’ makes pointer from integer without a cast [-Wint-conversion] 71 | fprintf("%d",primaAparitieX); | ^~~~~~~~~~~~~~ | | | int /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:60: note: expected ‘const char * restrict’ but argument is of type ‘int’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ numere32.c:71:13: warning: format not a string literal and no format arguments [-Wformat-security] 71 | fprintf("%d",primaAparitieX); | ^~~~~~~ numere32.c:80:20: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 80 | fscanf("%d",&n); | ^~~~ | | | char * /usr/include/stdio.h:422:37: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:80:25: warning: passing argument 2 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 80 | fscanf("%d",&n); | ^~ | | | int * /usr/include/stdio.h:423:43: note: expected ‘const char * restrict’ but argument is of type ‘int *’ 423 | const char *__restrict __format, ...) __wur __nonnull ((1)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:80:25: warning: format not a string literal and no format arguments [-Wformat-security] 80 | fscanf("%d",&n); | ^~ numere32.c:84:24: warning: passing argument 1 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 84 | fscanf("%d",&sir[i]); | ^~~~ | | | char * /usr/include/stdio.h:422:37: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:84:29: warning: passing argument 2 of ‘fscanf’ from incompatible pointer type [-Wincompatible-pointer-types] 84 | fscanf("%d",&sir[i]); | ^~~~~~~ | | | int * /usr/include/stdio.h:423:43: note: expected ‘const char * restrict’ but argument is of type ‘int *’ 423 | const char *__restrict __format, ...) __wur __nonnull ((1)); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:84:29: warning: format not a string literal and no format arguments [-Wformat-security] 84 | fscanf("%d",&sir[i]); | ^~~~~~~ numere32.c:96:21: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types] 96 | fprintf("%d %d", penultimaPoz, ultimaPoz); | ^~~~~~~ | | | char * /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:27: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:96:30: warning: passing argument 2 of ‘fprintf’ makes pointer from integer without a cast [-Wint-conversion] 96 | fprintf("%d %d", penultimaPoz, ultimaPoz); | ^~~~~~~~~~~~ | | | int /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:60: note: expected ‘const char * restrict’ but argument is of type ‘int’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ numere32.c:132:21: warning: passing argument 1 of ‘fprintf’ from incompatible pointer type [-Wincompatible-pointer-types] 132 | fprintf("%d ",sirX[i]); | ^~~~~~ | | | char * /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:27: note: expected ‘FILE * restrict’ but argument is of type ‘char *’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~^~~~~~~~ numere32.c:132:32: warning: passing argument 2 of ‘fprintf’ makes pointer from integer without a cast [-Wint-conversion] 132 | fprintf("%d ",sirX[i]); | ~~~~^~~ | | | int /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:60: note: expected ‘const char * restrict’ but argument is of type ‘int’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~ numere32.c:132:13: warning: format not a string literal and no format arguments [-Wformat-security] 132 | fprintf("%d ",sirX[i]); | ^~~~~~~ numere32.c:103:18: warning: unused variable ‘copieX’ [-Wunused-variable] 103 | int copieX = x; | ^~~~~~ numere32.c:28:22: warning: variable ‘out’ set but not used [-Wunused-but-set-variable] 28 | FILE *in, *out; | ^~~ numere32.c:28:17: warning: variable ‘in’ set but not used [-Wunused-but-set-variable] 28 | FILE *in, *out; | ^~ numere32.c:34:11: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 34 | fscanf("%d",&cerinta); | ^~~~~~~~~~~~~~~~~~~~~ numere32.c:36:11: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 36 | fscanf("%d",&x); | ^~~~~~~~~~~~~~~ numere32.c:57:13: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 57 | fscanf("%d",&n); | ^~~~~~~~~~~~~~~ numere32.c:62:17: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 62 | fscanf("%d",&sir[i]); | ^~~~~~~~~~~~~~~~~~~~ numere32.c:80:13: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 80 | fscanf("%d",&n); | ^~~~~~~~~~~~~~~ numere32.c:84:17: warning: ignoring return value of ‘fscanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 84 | fscanf("%d",&sir[i]); | ^~~~~~~~~~~~~~~~~~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 2 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 3 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 4 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 5 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 6 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 7 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
| 8 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 9 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 10 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 11 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 12 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 13 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
| 14 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 15 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 16 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 17 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 18 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
| 19 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 20 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 21 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 22 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 23 | 0.002 secunde | Raspuns gresit. | 3 | 0 | ||
| 24 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 25 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 26 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 27 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 28 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 29 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 30 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 31 | 0 secunde | Raspuns gresit. | 3 | 0 | ||
| 32 | 0.001 secunde | Raspuns gresit. | 3 | 0 | ||
| 33 | 0.001 secunde | Raspuns gresit. | 4 | 0 | ||
| Punctaj total | 0 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Numere32 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ă.