#3978
sabc
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 | #51564444 | Utilizator | |
Fișier | sabc.cpp | Dimensiune | 260 B |
Data încărcării | 12 Iulie 2024, 11:19 | Scor / rezultat | Eroare de compilare |
sabc.cpp: In function 'int main()': sabc.cpp:7:20: error: expression list treated as compound expression in initializer [-fpermissive] int a,b,c,s(a,b),s(b,c),s(a,c); ^ sabc.cpp:7:20: warning: left operand of comma operator has no effect [-Wunused-value] sabc.cpp:7:24: error: redeclaration of 'int s' int a,b,c,s(a,b),s(b,c),s(a,c); ^ sabc.cpp:7:15: error: 'int s' previously declared here int a,b,c,s(a,b),s(b,c),s(a,c); ^ sabc.cpp:7:31: error: redeclaration of 'int s' int a,b,c,s(a,b),s(b,c),s(a,c); ^ sabc.cpp:7:15: error: 'int s' previously declared here int a,b,c,s(a,b),s(b,c),s(a,c); ^ sabc.cpp:9:10: error: 's' cannot be used as a function s(a,b)=[b*(b+1)]/2; ^ sabc.cpp:9:14: error: expected ',' before '*' token s(a,b)=[b*(b+1)]/2; ^ sabc.cpp:9:14: error: expected identifier before '*' token sabc.cpp: In lambda function: sabc.cpp:9:21: error: expected '{' before '/' token s(a,b)=[b*(b+1)]/2; ^ sabc.cpp: In function 'int main()': sabc.cpp:9:21: error: no match for 'operator/' (operand types are 'main()::__lambda0' and 'int') sabc.cpp:10:10: error: 's' cannot be used as a function s(b,c)=[c*(c+1)]/2; ^ sabc.cpp:10:14: error: expected ',' before '*' token s(b,c)=[c*(c+1)]/2; ^ sabc.cpp:10:14: error: expected identifier before '*' token sabc.cpp: In lambda function: sabc.cpp:10:21: error: expected '{' before '/' token s(b,c)=[c*(c+1)]/2; ^ sabc.cpp: In function 'int main()': sabc.cpp:10:21: error: no match for 'operator/' (operand types are 'main()::__lambda1' and 'int') sabc.cpp:11:10: error: 's' cannot be used as a function s(a,c)=s(s,b)+s(b,c); ^ sabc.cpp:11:17: error: 's' cannot be used as a function s(a,c)=s(s,b)+s(b,c); ^ sabc.cpp:11:24: error: 's' cannot be used as a function s(a,c)=s(s,b)+s(b,c); ^ sabc.cpp:12:16: error: 's' cannot be used as a function cout<<s(a,b)<<" "<<s(b,c)<<" "<<s(a,c); ^ sabc.cpp:12:29: error: 's' cannot be used as a function cout<<s(a,b)<<" "<<s(b,c)<<" "<<s(a,c); ^ sabc.cpp:12:42: error: 's' cannot be used as a function cout<<s(a,b)<<" "<<s(b,c)<<" "<<s(a,c); ^
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ă.