#1422
În ograda lui Gigel se găsesc găini și văcuțe. Se dau două numere naturale: C – numărul de capete și P – numărul de picioare din curte.
1. Să se afișeze câte găini și câte văcuțe sunt în ograda lui Gigel.
2. Maria, colega lui Gigel, îl provoacă pe acesta să calculeze numărul de divizori impari pentru numărul C și numărul de divizori pari pentru numărul P. Deoarece Gigel nu este bun la matematică, vă cere ajutorul. Să se afișeze cele două numere calculate.
Moisil++, 2015
| Problema | Ograda | Operații I/O |
ograda.in/ograda.out
|
|---|---|---|---|
| Limita timp | 1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 10 MB
|
| Id soluție | #64642154 | Utilizator | |
| Fișier | ograda.cpp | Dimensiune | 601 B |
| Data încărcării | 20 Mai 2026, 08:41 | Scor/rezultat | Eroare de compilare |
ograda.cpp:4:14: warning: missing terminating " character 4 | ifstream fin("ograda.in); | ^ ograda.cpp:4:14: error: missing terminating " character 4 | ifstream fin("ograda.in); | ^~~~~~~~~~~~ ograda.cpp:5:27: error: expected ‘,’ or ‘...’ before ‘(’ token 5 | ifstream fout("ograda.out"); | ^ ograda.cpp:5:41: error: expected ‘)’ before ‘;’ token 5 | ifstream fout("ograda.out"); | ^ | ) ograda.cpp:4:13: note: to match this ‘(’ 4 | ifstream fin("ograda.in); | ^ ograda.cpp: In function ‘int main()’: ograda.cpp:9:5: error: invalid operands of types ‘std::ifstream(std::ifstream)’ {aka ‘std::basic_ifstream<char>(std::basic_ifstream<char>)’} and ‘long long int’ to binary ‘operator>>’ 9 | fin>>opt; | ~~~^~~~~ | | | | | long long int | std::ifstream(std::ifstream) {aka std::basic_ifstream<char>(std::basic_ifstream<char>)} ograda.cpp:10:9: error: invalid operands of types ‘std::ifstream(std::ifstream)’ {aka ‘std::basic_ifstream<char>(std::basic_ifstream<char>)’} and ‘long long int’ to binary ‘operator>>’ 10 | fin>>c>>p; | ~~~^~~ | | | | | long long int | std::ifstream(std::ifstream) {aka std::basic_ifstream<char>(std::basic_ifstream<char>)} ograda.cpp:15:10: error: ‘fout’ was not declared in this scope 15 | fout<<g<<' '<<v; | ^~~~ ograda.cpp:19:7: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation] 19 | for(d=1;d<=c;d++) | ^~~ ograda.cpp:22:11: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’ 22 | for(d=1;d<=p;d++) | ^~~ ograda.cpp:25:9: error: ‘fout’ was not declared in this scope 25 | fout<<nri<<' '<<nrp; | ^~~~ ograda.cpp:27:10: error: request for member ‘close’ in ‘fin’, which is of non-class type ‘std::ifstream(std::ifstream)’ {aka ‘std::basic_ifstream<char>(std::basic_ifstream<char>)’} 27 | fin.close(); | ^~~~~ ograda.cpp:28:6: error: ‘fout’ was not declared in this scope 28 | fout.close(); | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Ograda 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ă.