Task: | Suuremmat |
Sender: | Eljas |
Submission time: | 2021-01-23 17:31:33 +0200 |
Language: | C++ (C++17) |
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> #include <vector> #include <string> #define ll long long int main() { int n = 0; std::cin >> n; std::vector<ll> vec(n); for (int i = 0; i < n; i++) { std::cin >> vec[i]; } std::string s; std::string s1; std::string s2; std::string s3; char first; int length; for (int i = 0; i < n; i++) { ll x = vec[i]; s = std::to_string(x); length = s.length(); first = s[0]; s1 = std::string(length, first); s2 = std::string(length, first + 1); s3 = std::string(length + 1, '1'); if (std::stoll(s1) > x) { std::cout << s1; } else if (first < '9' && std::stoll(s2) > x) { std::cout << s2; } else { std::cout << s3; } std::cout << '\n'; } }
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 |