#2422
Se citesc mai multe numere naturale nenule. Fiecare astfel de număr X se va afișa, urmat de un triplet de numere a b c cu proprietatea că a+b+c=X, iar produsul lor este maxim.
| Problema | ProdusMaxim | Operații I/O |
produsmaxim.in/produsmaxim.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0 MB
|
| Id soluție | #64750993 | Utilizator | |
| Fișier | produsmaxim.cpp | Dimensiune | 584 B |
| Data încărcării | 27 Mai 2026, 18:45 | Scor/rezultat | Eroare de compilare |
produsmaxim.cpp: In function ‘int main()’: produsmaxim.cpp:17:43: error: expected ‘)’ before ‘mod’ 17 | fprintf(o, "%d %d %d", amod, a mod + 1, amod + 1); | ~ ^~~~ | ) produsmaxim.cpp:17:29: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long long int’ [-Wformat=] 17 | fprintf(o, "%d %d %d", amod, a mod + 1, amod + 1); | ~^ ~ | | | | int long long int | %lld produsmaxim.cpp:18:17: error: cannot convert ‘const char*’ to ‘FILE*’ 18 | fprintf("\n"); | ^~~~ | | | const char* In file included from /usr/include/stdio.h:980, from produsmaxim.cpp:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:77:27: note: initializing argument 1 of ‘int fprintf(FILE*, const char*, ...)’ 77 | fprintf (FILE *__restrict __stream, const char *__restrict __fmt, ...) | ~~~~~~~~~~~~~~~~~^~~~~~~~ produsmaxim.cpp:7:18: warning: unused variable ‘x’ [-Wunused-variable] 7 | long long a, x = 0, y = 0, z = 0, max = 1; | ^ produsmaxim.cpp:7:25: warning: unused variable ‘y’ [-Wunused-variable] 7 | long long a, x = 0, y = 0, z = 0, max = 1; | ^ produsmaxim.cpp:7:32: warning: unused variable ‘z’ [-Wunused-variable] 7 | long long a, x = 0, y = 0, z = 0, max = 1; | ^ produsmaxim.cpp:7:39: warning: unused variable ‘max’ [-Wunused-variable] 7 | long long a, x = 0, y = 0, z = 0, max = 1; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ProdusMaxim 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ă.