#2485
nxy
Se consideră N
, un număr natural nenul. Dorim să-l scriem pe N
ca sumă a două numere naturale nenule x
și y
, astfel încât suma cifrelor numerelor x
și y
să fie maximă. Scrieţi un program care să rezolve următoarele cerinţe:
1. să determine suma maximă a cifrelor a două numere x
și y
cu proprietatea că x+y=N
;
2. să determine două numere naturale nenule xmax
și ymax
cu proprietatea că xmax≥ymax
, xmax+ymax=N
, suma cifrelor lor este maximă, iar diferența xmax-ymax
este maximă;
3. să determine două numere naturale nenule xmin
și ymin
cu proprietatea că xmin≥ymin
, xmin+ymin=N
, suma cifrelor lor este maximă, iar diferența xmin-ymin
este minimă.
Problema | nxy | Operații I/O |
nxy.in /nxy.out
|
---|---|---|---|
Limita timp | 0.2 secunde | Limita memorie |
Total: 8 MB
/
Stivă 8 MB
|
Id soluție | #50067274 | Utilizator | |
Fișier | nxy.cpp | Dimensiune | 1.30 KB |
Data încărcării | 26 Martie 2024, 08:23 | Scor / rezultat | 40 puncte |
nxy.cpp: In function 'int main()': nxy.cpp:41:18: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses] if (r==1)if (ci>0) ci--; ^ nxy.cpp:7:57: warning: unused variable 'd' [-Wunused-variable] long long c,n,t1,s,t2,v1[22],v[22],r,z1,z2,n1,n2,n3,d,ci,uc,t,i,x,nr1,nr2; ^ nxy.cpp:7:62: warning: unused variable 'uc' [-Wunused-variable] long long c,n,t1,s,t2,v1[22],v[22],r,z1,z2,n1,n2,n3,d,ci,uc,t,i,x,nr1,nr2; ^ nxy.cpp:7:65: warning: unused variable 't' [-Wunused-variable] long long c,n,t1,s,t2,v1[22],v[22],r,z1,z2,n1,n2,n3,d,ci,uc,t,i,x,nr1,nr2; ^ nxy.cpp:7:69: warning: unused variable 'x' [-Wunused-variable] long long c,n,t1,s,t2,v1[22],v[22],r,z1,z2,n1,n2,n3,d,ci,uc,t,i,x,nr1,nr2; ^ nxy.cpp:7:71: warning: unused variable 'nr1' [-Wunused-variable] long long c,n,t1,s,t2,v1[22],v[22],r,z1,z2,n1,n2,n3,d,ci,uc,t,i,x,nr1,nr2; ^ nxy.cpp:7:75: warning: unused variable 'nr2' [-Wunused-variable] long long c,n,t1,s,t2,v1[22],v[22],r,z1,z2,n1,n2,n3,d,ci,uc,t,i,x,nr1,nr2; ^
Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
---|---|---|---|---|---|---|
3 | 0 secunde | OK. | 1 | 1 | ||
4 | 0 secunde | OK. | 2 | 2 | ||
5 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
6 | 0 secunde | OK. | 1 | 1 | ||
7 | 0 secunde | OK. | 2 | 2 | ||
8 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
9 | 0 secunde | OK. | 1 | 1 | ||
10 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
11 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
12 | 0 secunde | OK. | 1 | 1 | ||
13 | 0 secunde | OK. | 2 | 2 | ||
14 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
15 | 0 secunde | OK. | 1 | 1 | ||
16 | 0 secunde | OK. | 2 | 2 | ||
17 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
18 | 0 secunde | OK. | 1 | 1 | ||
19 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
20 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
21 | 0 secunde | OK. | 1 | 1 | ||
22 | 0 secunde | OK. | 2 | 2 | ||
23 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
24 | 0 secunde | OK. | 1 | 1 | ||
25 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
26 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
27 | 0 secunde | OK. | 1 | 1 | ||
28 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
29 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
30 | 0 secunde | OK. | 1 | 1 | ||
31 | 0 secunde | OK. | 2 | 2 | ||
32 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
33 | 0 secunde | OK. | 1 | 1 | ||
34 | 0 secunde | OK. | 2 | 2 | ||
35 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
36 | 0 secunde | OK. | 1 | 1 | ||
37 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
38 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
39 | 0 secunde | OK. | 1 | 1 | ||
40 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
41 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
42 | 0 secunde | OK. | 1 | 1 | ||
43 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
44 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
45 | 0 secunde | OK. | 1 | 1 | ||
46 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
47 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
48 | 0 secunde | OK. | 1 | 1 | ||
49 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
50 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
51 | 0 secunde | OK. | 1 | 1 | ||
52 | 0 secunde | OK. | 2 | 2 | ||
53 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
54 | 0 secunde | OK. | 1 | 1 | ||
55 | 0 secunde | OK. | 2 | 2 | ||
56 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
57 | 0 secunde | OK. | 1 | 1 | ||
58 | 0 secunde | OK. | 2 | 2 | ||
59 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
60 | 0 secunde | OK. | 1 | 1 | ||
61 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
62 | 0 secunde | Raspuns gresit. | 2 | 0 | ||
Punctaj total | 40 |
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema nxy 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ă.