#303
Se dau n
numere naturale mai mici decât 1.000.000
. Determinaţi câte dintre ele sunt prime.
Problema | Eratostene | Operații I/O |
![]() eratostene.in /eratostene.out
|
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #58172846 | Utilizator | |
Fișier | eratostene.c | Dimensiune | 644 B |
Data încărcării | 18 Mai 2025, 16:07 | Scor / rezultat | 0 puncte |
eratostene.c: In function 'main': eratostene.c:14:6: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d" ,in ,&N); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from eratostene.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * restrict' but argument is of type 'char *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ eratostene.c:14:6: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d" ,in ,&N); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from eratostene.c:1: /usr/include/stdio.h:443:12: note: expected 'const char * restrict' but argument is of type 'struct FILE *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ eratostene.c:19:17: warning: statement with no effect [-Wunused-value] ciur[m]==1; ^ eratostene.c:26:9: warning: passing argument 1 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d" ,in ,&x); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from eratostene.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * restrict' but argument is of type 'char *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ eratostene.c:26:9: warning: passing argument 2 of 'fscanf' from incompatible pointer type [enabled by default] fscanf("%d" ,in ,&x); ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from eratostene.c:1: /usr/include/stdio.h:443:12: note: expected 'const char * restrict' but argument is of type 'struct FILE *' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ eratostene.c:31:6: warning: passing argument 1 of 'fprintf' from incompatible pointer type [enabled by default] fprintf("%d" ,out ,cont); ^ In file included from /usr/include/stdio.h:937:0, from eratostene.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'struct FILE * restrict' but argument is of type 'char *' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^ eratostene.c:31:6: warning: passing argument 2 of 'fprintf' from incompatible pointer type [enabled by default] fprintf("%d" ,out ,cont); ^ In file included from /usr/include/stdio.h:937:0, from eratostene.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'const char * restrict' but argument is of type 'struct FILE *' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^ eratostene.c:14:12: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf("%d" ,in ,&N); ^ eratostene.c:26:15: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf("%d" ,in ,&x); ^ eratostene.c:28:17: warning: 'cont' may be used uninitialized in this function [-Wmaybe-uninitialized] cont++; ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
1 | 0 secunde | Caught fatal signal 11 | 20 | 0 | Exemplu | |
2 | 0 secunde | Caught fatal signal 11 | 40 | 0 | ||
3 | 0 secunde | Caught fatal signal 11 | 40 | 0 | ||
Punctaj total | 0 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Eratostene 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ă.