System Testing
0 / 11
CE
0/11 test cases passed
Submission #3
| Problem | NumReverseEasy |
|---|---|
| Handle | test-ce |
| Submitted | 2026-07-05 07:56:28 |
System Messages
In file included from main.cpp:4:
solution.cpp: In member function 'long long int NumReverseEasy::getsum(int, int)':
solution.cpp:9:9: error: expected ',' or ';' before 'for'
9 | for (int n = A; n <= B; n++) {
| ^~~
solution.cpp:9:25: error: 'n' was not declared in this scope; did you mean 'yn'?
9 | for (int n = A; n <= B; n++) {
| ^
| yn
Source Code
#include <string>
#include <algorithm>
using namespace std;
class NumReverseEasy {
public:
long long getsum(int A, int B) {
long long total = 0
for (int n = A; n <= B; n++) {
string s = to_string(n);
reverse(s.begin(), s.end());
total += max((long long)n, (long long)stoll(s));
}
return total;
}
};