Task: | Greater Integers |
Sender: | lolok123 |
Submission time: | 2021-01-31 09:17:14 +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 |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:22:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(ind=0;ind<num.size();ind++){ ~~~^~~~~~~~~~~ input/code.cpp:25:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if(ind+1==num.size()){ ~~~~~^~~~~~~~~~~~ input/code.cpp:30:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<num.size();++i){ ~^~~~~~~~~~~ input/code.cpp:36:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0;i<num.size();++i){ ~^~~~~~~~~~~
Code
#define MOD 1000000007 #include <bits/stdc++.h> #include <numeric> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int T; cin>>T; for(int T_Case=1;T_Case<=T;++T_Case){ string num,ans; int ind; long long int val; cin>>val; ++val; num=to_string(val); for(ind=0;ind<num.size();ind++){ if(num[ind]!=num[ind]+1) break; } if(ind+1==num.size()){ ans=num; } else if(num[ind]>num[ind+1]){ ans.resize(num.size()); for(int i=0;i<num.size();++i){ ans[i]=num[ind]; } } else{ ans.resize(num.size()); for(int i=0;i<num.size();++i){ ans[i]=num[ind]+1; } } cout<<ans<<'\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 |
---|
777777777777777777 777777777777777777 555555555555555555 111111111111111111 55555555555555 ... Truncated |