Task: | Greater Integers |
Sender: | doowey |
Submission time: | 2021-01-31 13:33:04 +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 |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:15:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0 ;i < q.size(); i ++ ){ ~~^~~~~~~~~~ input/code.cpp:25:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0 ;i <= q.size(); i ++ ) cout << "1"; ~~^~~~~~~~~~~
Code
#include <bits/stdc++.h> using namespace std; int main(){ int tc; cin >> tc; for(int t = 1; t <= tc;t ++ ){ string q; cin >> q; string sol; bool has=false; for(int d = 1; d <= 9; d ++ ){ string cur; for(int i = 0 ;i < q.size(); i ++ ){ cur.push_back(char(d + '0')); } if(cur > q){ has=true; sol=cur; break; } } if(!has){ for(int i = 0 ;i <= q.size(); i ++ ) cout << "1"; cout << "\n"; } else{ cout << sol << "\n"; } } return 0; }
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 |