| Task: | Alien Invasion II |
| Sender: | phid |
| Submission time: | 2020-09-19 13:29:50 +0300 |
| Language: | C++ (C++11) |
| Status: | READY |
| Result: | RUNTIME ERROR |
| test | verdict | time | |
|---|---|---|---|
| #1 | RUNTIME ERROR | 0.01 s | details |
| #2 | RUNTIME ERROR | 0.01 s | details |
| #3 | RUNTIME ERROR | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:18:22: warning: 's' may be used uninitialized in this function [-Wmaybe-uninitialized]
int add = 3 - (s % 3);
~~~^~~~Code
#include <iostream>
#include <string>
using namespace std;
int main() {
int x;
cin >> x;
int t = x;
int s, m;
while(x > 0)
{
m = x % 10;
s += m;
x /= 10;
}
cout << s << endl;
int add = 3 - (s % 3);
string str = to_string(add) + to_string(t);
cout << str << endl;
x = stoi(str);
cout << 3 << " " << x / 3;
return 0;
}Test details
Test 1
Verdict: RUNTIME ERROR
| input |
|---|
| 2368469234876449 |
| correct output |
|---|
| 22368469234876449 3 7456156411625483 |
| user output |
|---|
| 46 22147483647 |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): stoi
Test 2
Verdict: RUNTIME ERROR
| input |
|---|
| 292929292929292929292929292931 |
| correct output |
|---|
| 129292929292929292929292929293... |
| user output |
|---|
| 46 22147483647 |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): stoi
Test 3
Verdict: RUNTIME ERROR
| input |
|---|
| 292929292929292929292929292979 |
| correct output |
|---|
| 129292929292929292929292929297... |
| user output |
|---|
| 46 22147483647 |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): stoi
