#4699
Subprogramul moderat
are un singur parametru, n
, prin care primește un număr natural (n ∈ [1, 1.000.000.000]
). Subprogramul returnează valoarea 1
dacă n
este un număr moderat, sau valoarea 0
în caz contrar. Scrieți definiția completă a subprogramului.
Bac 2024, sesiunea august
Problema | moderat | Operații I/O |
![]() moderat.in /moderat.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 2 MB
/
Stivă 1 MB
|
Id soluție | #58111725 | Utilizator | |
Fișier | moderat.cpp | Dimensiune | 507 B |
Data încărcării | 14 Mai 2025, 17:02 | Scor / rezultat | Eroare de compilare |
moderat.cpp: In function 'bool Moderat(int)': moderat.cpp:22:13: error: 'nt' was not declared in this scope nt next = i + 1; ^ moderat.cpp:22:16: error: expected ';' before 'next' nt next = i + 1; ^ moderat.cpp:23:28: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator<=' while (next <= q && !isPrime(next)) next++; ^ moderat.cpp:23:46: error: cannot resolve overloaded function 'next' based on conversion to type 'int' while (next <= q && !isPrime(next)) next++; ^ moderat.cpp:23:53: error: no post-increment operator for type while (next <= q && !isPrime(next)) next++; ^ moderat.cpp:24:25: error: invalid operands of types '<unresolved overloaded function type>' and 'int' to binary 'operator==' if (next == q) return 1; ^ moderat.cpp: At global scope: moderat.cpp:28:5: error: expected unqualified-id before 'return' return 0; ^ moderat.cpp:29:1: error: expected declaration before '}' token } ^ moderat.cpp: In function 'bool Moderat(int)': moderat.cpp:27:5: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema moderat 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ă.