#2642
phi
C++
Să se scrie funcția cu următorul antet:
int Phi(int n)
Funcția primește ca parametru un număr natural n
și trebuie să returneze numărul de numere naturale nenule prime cu n
și strict mai mici decât n
.
Folclorul informatic
Problema | phi | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #14382634 | Utilizator | |
Fișier | phi.cpp | Dimensiune | 318 B |
Data încărcării | 02 Martie 2019, 21:52 | Scor / rezultat | Eroare de compilare |
phi.cpp:8:2: error: stray '\302' in program int nr=1,d=2,p; ^ phi.cpp:8:2: error: stray '\240' in program phi.cpp:8:2: error: stray '\302' in program phi.cpp:8:2: error: stray '\240' in program phi.cpp:10:2: error: stray '\302' in program while(n>1) ^ phi.cpp:10:2: error: stray '\240' in program phi.cpp:10:2: error: stray '\302' in program phi.cpp:10:2: error: stray '\240' in program phi.cpp:12:2: error: stray '\302' in program { ^ phi.cpp:12:2: error: stray '\240' in program phi.cpp:12:2: error: stray '\302' in program phi.cpp:12:2: error: stray '\240' in program phi.cpp:14:2: error: stray '\302' in program p=0; ^ phi.cpp:14:2: error: stray '\240' in program phi.cpp:14:2: error: stray '\302' in program phi.cpp:14:2: error: stray '\240' in program phi.cpp:14:2: error: stray '\302' in program phi.cpp:14:2: error: stray '\240' in program phi.cpp:14:2: error: stray '\302' in program phi.cpp:14:2: error: stray '\240' in program phi.cpp:16:2: error: stray '\302' in program while(n%d==0) ^ phi.cpp:16:2: error: stray '\240' in program phi.cpp:16:2: error: stray '\302' in program phi.cpp:16:2: error: stray '\240' in program phi.cpp:16:2: error: stray '\302' in program phi.cpp:16:2: error: stray '\240' in program phi.cpp:16:2: error: stray '\302' in program phi.cpp:16:2: error: stray '\240' in program phi.cpp:18:9: error: stray '\302' in program { ++p; ^ phi.cpp:18:9: error: stray '\240' in program phi.cpp:21:2: error: stray '\302' in program if(p) ^ phi.cpp:21:2: error: stray '\240' in program phi.cpp:21:2: error: stray '\302' in program phi.cpp:21:2: error: stray '\240' in program phi.cpp:21:2: error: stray '\302' in program phi.cpp:21:2: error: stray '\240' in program phi.cpp:21:2: error: stray '\302' in program phi.cpp:21:2: error: stray '\240' in program phi.cpp:23:2: error: stray '\302' in program ^ phi.cpp:23:2: error: stray '\240' in program phi.cpp:23:2: error: stray '\302' in program phi.cpp:23:2: error: stray '\240' in program phi.cpp:23:2: error: stray '\302' in program phi.cpp:23:2: error: stray '\240' in program phi.cpp:23:2: error: stray '\302' in program phi.cpp:23:2: error: stray '\240' in program phi.cpp:26:2: error: stray '\302' in program if(n>1 && d*d>n) ^ phi.cpp:26:2: error: stray '\240' in program phi.cpp:26:2: error: stray '\302' in program phi.cpp:26:2: error: stray '\240' in program phi.cpp:26:2: error: stray '\302' in program phi.cpp:26:2: error: stray '\240' in program phi.cpp:26:2: error: stray '\302' in program phi.cpp:26:2: error: stray '\240' in program phi.cpp:27:2: error: stray '\302' in program d=n; ^ phi.cpp:27:2: error: stray '\240' in program phi.cpp:27:2: error: stray '\302' in program phi.cpp:27:2: error: stray '\240' in program phi.cpp:27:2: error: stray '\302' in program phi.cpp:27:2: error: stray '\240' in program phi.cpp:27:2: error: stray '\302' in program phi.cpp:27:2: error: stray '\240' in program phi.cpp:28:2: error: stray '\302' in program } ^ phi.cpp:28:2: error: stray '\240' in program phi.cpp:28:2: error: stray '\302' in program phi.cpp:28:2: error: stray '\240' in program phi.cpp:30:2: error: stray '\302' in program return nr; ^ phi.cpp:30:2: error: stray '\240' in program phi.cpp:30:2: error: stray '\302' in program phi.cpp:30:2: error: stray '\240' in program phi.cpp: In function 'int Phi(int)': phi.cpp:22:22: error: 'pow' was not declared in this scope nr*=(d-1)*pow(d,p-1); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema phi face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. 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ă.