Task: | Alien Invasion II |
Sender: | phid |
Submission time: | 2020-09-19 13:15:15 +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:11:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for (int i = 0; i < str.size(); i++) { ~~^~~~~~~~~~~~ input/code.cpp:14:9: warning: unused variable 'add' [-Wunused-variable] int add = 3 - (s % 3); ^~~
Code
#include <iostream> #include <string> using namespace std; int main() { int x; cin >> x; string str = to_string(x); int s = 0; for (int i = 0; i < str.size(); i++) { s += (int) i; } int add = 3 - (s % 3); str = to_string(x) + str; 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 |
---|
21474836472147483647 |
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 |
---|
21474836472147483647 |
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 |
---|
21474836472147483647 |
Error:
terminate called after throwing an instance of 'std::out_of_range' what(): stoi