Submission details
Task:Alien Invasion II
Sender:phid
Submission time:2020-09-19 13:16:21 +0300
Language:C++ (C++11)
Status:READY
Result:
Test results
testverdicttime
#10.01 sdetails
#20.01 sdetails
#30.01 sdetails

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++) {
                     ~~^~~~~~~~~~~~

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(add) + str;
    cout << str << endl;
    x = stoi(str);
    cout << 3 << " " << x / 3;
    return 0;
}

Test details

Test 1

Verdict:

input
2368469234876449

correct output
22368469234876449
3 7456156411625483

user output
32147483647

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  stoi

Test 2

Verdict:

input
292929292929292929292929292931

correct output
129292929292929292929292929293...

user output
32147483647

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  stoi

Test 3

Verdict:

input
292929292929292929292929292979

correct output
129292929292929292929292929297...

user output
32147483647

Error:
terminate called after throwing an instance of 'std::out_of_range'
  what():  stoi