#2146
doilan
Fie n
un număr natural nenul.
Se construiește mulțimea M
a tuturor numerelor formate din exact n
cifre, numere formate doar cu cifrele 1
și 2
.
Scrieți un program care citește numărul natural n
și apoi determină cel mai mic număr natural x
din mulțimea M
cu proprietatea că x
este divizibil cu 2
n
.
ONIGIM 2017, Clasa a VIII-a
Problema | doilan | Operații I/O |
doilan.in /doilan.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 2 MB
/
Stivă 2 MB
|
Id soluție | #19470384 | Utilizator | |
Fișier | doilan.c | Dimensiune | 627 B |
Data încărcării | 09 Decembrie 2019, 15:51 | Scor / rezultat | Eroare de compilare |
doilan.c:4:2: warning: data definition has no type or storage class [enabled by default] fin=fopen("doilan.in","r"); ^ doilan.c:4:2: warning: type defaults to 'int' in declaration of 'fin' [-Wimplicit-int] doilan.c:4:2: error: conflicting types for 'fin' doilan.c:2:7: note: previous declaration of 'fin' was here FILE *fin,*fout; ^ doilan.c:4:6: warning: initialization makes integer from pointer without a cast [enabled by default] fin=fopen("doilan.in","r"); ^ doilan.c:4:2: error: initializer element is not constant fin=fopen("doilan.in","r"); ^ doilan.c:5:2: warning: data definition has no type or storage class [enabled by default] fout=fopen("doilan.out","w"); ^ doilan.c:5:2: warning: type defaults to 'int' in declaration of 'fout' [-Wimplicit-int] doilan.c:5:2: error: conflicting types for 'fout' doilan.c:2:12: note: previous declaration of 'fout' was here FILE *fin,*fout; ^ doilan.c:5:7: warning: initialization makes integer from pointer without a cast [enabled by default] fout=fopen("doilan.out","w"); ^ doilan.c:5:2: error: initializer element is not constant fout=fopen("doilan.out","w"); ^ doilan.c: In function 'main': doilan.c:21:4: warning: passing argument 1 of 'fscanf' makes pointer from integer without a cast [enabled by default] if(fscanf(fin,"%d",&n)){;} ^ In file included from /usr/include/features.h:374:0, from /usr/include/stdio.h:27, from doilan.c:1: /usr/include/stdio.h:443:12: note: expected 'struct FILE * __restrict__' but argument is of type 'int' extern int __REDIRECT (fscanf, (FILE *__restrict __stream, ^ doilan.c:27:5: warning: passing argument 1 of 'fprintf' makes pointer from integer without a cast [enabled by default] for(i=1; i<=n; i++){fprintf(fout,"%d",a[i]);} ^ In file included from /usr/include/stdio.h:937:0, from doilan.c:1: /usr/include/i386-linux-gnu/bits/stdio2.h:95:1: note: expected 'struct FILE * __restrict__' but argument is of type 'int' fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema doilan 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ă.