#1341
În țara lui Zoli trăiesc n persoane, numerotate de la 1 la n, iar Zoli are numărul de ordine 1. Zoli s-a săturat de sistemul politic, așa că s-a decis să iasă în stradă. Deoarece Zoli este o persoană sociabilă, are prieteni din diverse cercuri pe care s-a gândit să îi cheme cu el. Zoli își va anunța prietenii, care la rândul lor își vor anunța prietenii și așa mai departe.
Știm însă că unele persoane sunt scandalagii, iar Zoli este un om pașnic și preferă să nu trimită invitația acestora.
Zoli vă cere să îi spuneți numărul de persoane cu care se va întâlni la protest.
| Problema | Protest | Operații I/O |
protest.in/protest.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64285645 | Utilizator | |
| Fișier | protest.cpp | Dimensiune | 514 B |
| Data încărcării | 28 Aprilie 2026, 08:48 | Scor/rezultat | Eroare de compilare |
protest.cpp: In function ‘int main()’: protest.cpp:9:12: error: cannot convert ‘const char*’ to ‘FILE*’ 9 | fscanf("%d%d",&n,&k); | ^~~~~~ | | | const char* In file included from protest.cpp:1: /usr/include/stdio.h:422:37: note: initializing argument 1 of ‘int fscanf(FILE*, const char*, ...)’ 422 | extern int fscanf (FILE *__restrict __stream, | ~~~~~~~~~~~~~~~~~^~~~~~~~ protest.cpp:10:5: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 10 | for(int i=1;i<=k;i++) | ^~~ protest.cpp:12:9: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 12 | for(int i=1;i<=50000;i++) | ^~~ In file included from /usr/include/stdio.h:34: protest.cpp:13:18: error: no match for ‘operator=’ (operand types are ‘nod’ and ‘long int’) 13 | l[i]=NULL; | ^~~~ protest.cpp:2:8: note: candidate: ‘nod& nod::operator=(const nod&)’ 2 | struct nod{int inf;nod*adr;}l[50000]; | ^~~ protest.cpp:2:8: note: no known conversion for argument 1 from ‘long int’ to ‘const nod&’ protest.cpp:2:8: note: candidate: ‘nod& nod::operator=(nod&&)’ protest.cpp:2:8: note: no known conversion for argument 1 from ‘long int’ to ‘nod&&’ protest.cpp:16:26: error: ‘x’ was not declared in this scope 16 | fscanf(f,"%d%d",&x,&y); | ^ protest.cpp:16:29: error: ‘y’ was not declared in this scope 16 | fscanf(f,"%d%d",&x,&y); | ^ protest.cpp:18:34: error: expected primary-expression before ‘)’ token 18 | e=(ref)malloc(sizeof*(nod)); | ^ protest.cpp:18:16: error: ‘malloc’ was not declared in this scope 18 | e=(ref)malloc(sizeof*(nod)); | ^~~~~~ protest.cpp:2:1: note: ‘malloc’ is defined in header ‘<cstdlib>’; did you forget to ‘#include <cstdlib>’? 1 | #include<stdio.h> +++ |+#include <cstdlib> 2 | struct nod{int inf;nod*adr;}l[50000];
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Protest 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ă.