Task: | Greater Integers |
Sender: | TryMax |
Submission time: | 2021-01-30 14:47:14 +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:34:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < s.size() && f; ++j){ ~~^~~~~~~~~~ input/code.cpp:41:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int j = 0; j < s.size(); ++j) ~~^~~~~~~~~~
Code
#include <bits/stdc++.h>//#include <ext/pb_ds/assoc_container.hpp>//#include <ext/pb_ds/tree_policy.hpp>//#pragma GCC optimize ("O3")//#pragma GCC optimize ("Ofast")//#pragma GCC optimize ("unroll-loops")//#pragma GCC optimize ("trapv")//#pragma GCC optimize ("sse, ssse, sse2, avx")#define f first#define s second#define pb push_back#define ld long double#define int long longusing namespace std;const int N = 2e5 + 10, mod = 1e9 + 7, inf = 1e18 + 10;signed main(){ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);int t; cin >> t;while(t--){int n; cin >> n;++n;string s;while(n)s = (char)(n % 10 + '0') + s, n /= 10;for(int i = 1; i <= 9; ++i){bool f = true, was = false;for(int j = 0; j < s.size() && f; ++j){if(s[j] - '0' < i)was = true;if(!(was || s[j] - '0' <= i))f = false;}if(f){for(int j = 0; j < s.size(); ++j)cout << i;cout << "\n";break;}}}}
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 |