#3978
Dacă x
și y
sunt două numere naturale cu x ≤ y
, atunci notăm cu s(x,y)
suma numerelor naturale cuprinse între x
și y
. De exemplu, s(3,6) = 3+4+5+6 = 18
, iar s(7,7) = 7
. Se dau numerele naturale a
, b
și c
, unde a ≤ b ≤ c
. Calculați s(a,b)
, s(b,c)
și s(a,c)
.
Problema | sabc | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57698314 | Utilizator | |
Fișier | sabc.cpp | Dimensiune | 325 B |
Data încărcării | 10 Aprilie 2025, 20:37 | Scor / rezultat | Eroare de compilare |
sabc.cpp:8:6: error: stray '\342' in program x ≤ y; ^ sabc.cpp:8:6: error: stray '\211' in program sabc.cpp:8:6: error: stray '\244' in program sabc.cpp:15:5: error: stray '\342' in program a ≤ b ≤ c; ^ sabc.cpp:15:5: error: stray '\211' in program sabc.cpp:15:5: error: stray '\244' in program sabc.cpp:15:5: error: stray '\342' in program sabc.cpp:15:5: error: stray '\211' in program sabc.cpp:15:5: error: stray '\244' in program sabc.cpp: In function 'int main()': sabc.cpp:7:29: error: expression list treated as compound expression in initializer [-fpermissive] unsigned int x, y, s(x,y); ^ sabc.cpp:7:29: warning: left operand of comma operator has no effect [-Wunused-value] sabc.cpp:8:12: error: expected ';' before 'y' x ≤ y; ^ sabc.cpp:8:13: warning: statement has no effect [-Wunused-value] x ≤ y; ^ sabc.cpp:9:19: warning: right operand of comma operator has no effect [-Wunused-value] cin >> x, y, s; ^ sabc.cpp:9:20: warning: right operand of comma operator has no effect [-Wunused-value] cin >> x, y, s; ^ sabc.cpp:10:11: error: 's' cannot be used as a function s(x,y) = y*(y+1)/2 - (x-1)*x/2; ^ sabc.cpp: In function 'int main()': sabc.cpp:12:5: error: redefinition of 'int main()' int main() ^ sabc.cpp:5:5: error: 'int main()' previously defined here int main() ^ sabc.cpp:15:11: error: expected ';' before 'b' a ≤ b ≤ c; ^ sabc.cpp:15:18: warning: statement has no effect [-Wunused-value] a ≤ b ≤ c; ^ sabc.cpp:17:18: error: 's' was not declared in this scope cout << s(a,b) << s(b,c) << s(a,c) <<endl; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sabc 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ă.