Task: | Suuremmat |
Sender: | Nanohenry |
Submission time: | 2021-01-23 16:19:56 +0200 |
Language: | C++ (C++11) |
Status: | READY |
Result: | 100 |
group | verdict | score |
---|---|---|
#1 | ACCEPTED | 35 |
#2 | ACCEPTED | 65 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | ACCEPTED | 0.01 s | 1, 2 | details |
#2 | ACCEPTED | 0.01 s | 2 | details |
Code
#include <iostream>using namespace std;int64_t n, t, c, b;inline int64_t s1(int64_t x) {x++;c = 0;while (x >= 10) {x /= 10;c++;}b = x;x = 0;for (int64_t i = 0; i <= c; i++) {x *= 10;x += b;}return x;}inline int64_t s2(int64_t x) {x++;c = 0;while (x >= 10) {x /= 10;c++;}b = x == 9? 1 : x + 1;x = 0;for (int64_t i = 0; i <= c; i++) {x *= 10;x += b;}return x;}int main() {cin >> n;for (int64_t i = 0; i < n; i++) {cin >> t;int64_t s = s1(t);if (s > t) {cout << s << endl;} else {cout << s2(t) << endl;}}}
Test details
Test 1
Group: 1, 2
Verdict: ACCEPTED
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: ACCEPTED
input |
---|
1000 735425311146082632 756615631808964686 466489470801941584 100417544394053220 ... |
correct output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 555555555555555555 ... |
user output |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 55555555555555 ... Truncated |