Task: | Suuremmat |
Sender: | Eljas |
Submission time: | 2021-01-23 17:04:53 +0200 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
#2 | WRONG ANSWER | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | 1, 2 | details |
#2 | WRONG ANSWER | 0.01 s | 2 | details |
Code
#include <iostream> #include <vector> #include <string> int main() { int n = 0; std::cin >> n; std::vector<int> vec(n); for (int i = 0; i < n; i++) { std::cin >> vec[i]; } std::string s; char first; int length; int nineLength; bool increase; for (int i = 0; i < n; i++) { s = std::to_string(vec[i]); length = s.size(); first = s[0] - '0'; nineLength = first == 9; increase = length == 1; int j = 1; while (s[j] == 9 && j < length) { nineLength++; j++; } if (nineLength == length) { for (int j = 0; j < length + 1; j++) { std::cout << '1'; } } else { while (j < length) { if (s[0] > first) { increase = true; } j++; } std::string s2; if (increase) { s2 = std::to_string(first + 1); } else { s2 = std::to_string(first); } for (int j = 0; j < length; j++) { std::cout << s2; } } std::cout << '\n'; } }
Test details
Test 1
Group: 1, 2
Verdict: WRONG ANSWER
input |
---|
1000 1 2 3 4 ... |
correct output |
---|
2 3 4 5 6 ... |
user output |
---|
2 3 4 5 6 ... Truncated |
Test 2
Group: 2
Verdict: WRONG ANSWER
input |
---|
1000 735425311146082632 756615631808964686 466489470801941584 100417544394053220 ... |
correct output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 555555555555555555 ... |
user output |
---|
3333333333 1 1 1 1 ... Truncated |