6385 | 2023-11-26 12:47:04 | Error42 | Számjegy keverés | cpp17 | Forditási hiba |
// Code of `CWM`, only "debugged" by `Error42`
#include <cassert>
#include <iostream>
using namespace std;
int main()
{
string s;
cin >> s;
assert(s.size() <= 10'001)
long long res = s.size() * (s.size() - 1) / 2 * 9;
for (size_t i = 0; i < s.size(); i++)
{
assert(s[i] >= '0' && s[i] <= '9')
res += s[i] - '0';
}
cout << res << "\n";
}
exit status 1
main.cpp: In function 'int main()':
main.cpp:15:5: error: expected ';' before 'long'
15 | long long res = s.size() * (s.size() - 1) / 2 * 9;
| ^~~~
main.cpp:20:9: error: expected ';' before 'res'
20 | res += s[i] - '0';
| ^~~
main.cpp:22:13: error: 'res' was not declared in this scope
22 | cout << res << "\n";
| ^~~
Exited with error status 1