#1479
pretios
Un număr natural în baza 10
se numește prețios dacă numărul de cifre ale sale din baza 2
este număr prim.
Se dă un interval [a,b]
.Determinați câte numere prețioase se află în acest interval.
Problema | pretios | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 4 MB
/
Stivă 1 MB
|
Id soluție | #50871629 | Utilizator | |
Fișier | pretios.cpp | Dimensiune | 552 B |
Data încărcării | 11 Mai 2024, 12:14 | Scor / rezultat | Eroare de compilare |
pretios.cpp:13:13: error: expected initializer before 'long' int usigned long long start,stop; ^ pretios.cpp:14:13: error: expected initializer before 'long' int usigned long long a,b,i,nr,p=1; ^ pretios.cpp: In function 'int main()': pretios.cpp:16:7: error: 'a' was not declared in this scope {cin>>a>>b; ^ pretios.cpp:16:10: error: 'b' was not declared in this scope {cin>>a>>b; ^ pretios.cpp:17:2: error: 'start' was not declared in this scope start=log2(a)+1; ^ pretios.cpp:18:2: error: 'stop' was not declared in this scope stop=log2(b); ^ pretios.cpp:19:6: error: 'i' was not declared in this scope for(i=1;i<=start;i++) ^ pretios.cpp:20:6: error: 'p' was not declared in this scope p*=2; ^ pretios.cpp:22:3: error: 'nr' was not declared in this scope {nr+=p-a; ^ pretios.cpp:22:7: error: 'p' was not declared in this scope {nr+=p-a; ^ pretios.cpp:23:7: error: 'i' was not declared in this scope }for(i=start;i<stop;i++) ^ pretios.cpp:25:3: error: 'nr' was not declared in this scope {nr+=p; ^ pretios.cpp:25:7: error: 'p' was not declared in this scope {nr+=p; ^ pretios.cpp:27:7: error: 'p' was not declared in this scope else p*=2; ^ pretios.cpp:29:6: error: 'nr' was not declared in this scope nr+=b-p+1; ^ pretios.cpp:29:12: error: 'p' was not declared in this scope nr+=b-p+1; ^ pretios.cpp:30:8: error: 'nr' was not declared in this scope cout<<nr<<" "; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pretios 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ă.