Task: | Greater Integers |
Sender: | Norimo2 |
Submission time: | 2021-01-30 12:32:11 +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 <cmath> # include <algorithm> # include <stdio.h> # include <cstdint> # include <cstring> # include <string> # include <cstdlib> # include <vector> # include <bitset> # include <map> # include <queue> # include <ctime> # include <stack> # include <set> # include <list> # include <random> # include <deque> # include <functional> # include <iomanip> # include <sstream> # include <fstream> # include <complex> # include <numeric> # include <immintrin.h> # include <cassert> # include <array> # include <tuple> # include <unordered_set> # include <unordered_map> //#include<bits/stdc++.h> #define LL long long #define LD long double #define pb push_back #define mp make_pair #define ss second #define ff first #define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) #define _sz(x) (LL)x.size() #define _all(x) x.begin(),x.end() #define el '\n' #define eb emplace_back using namespace std; const LL N = 1, INF = 1e18; void solve() { LL n = 0; string s; cin >> s; LL ans1 = 0, ans2 = 0; for(LL i = 0; i < _sz(s); i++) { ans1 = ans1 * 10 + (s[0] - '0'); n = n * 10 + (s[i] - '0'); } if(s[0] == '9') { for(LL i = 0; i < _sz(s)+1; i++) ans2 = ans2*10 + 1; } else { for(LL i = 0; i < _sz(s); i++) ans2 = ans2*10 + (s[0]-'0'+1); } if(ans1 <= n) cout << ans2 << el; else cout << ans1 << el; } int main() { opt; LL q = 1; cin >> q; while(q--) solve(); 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 |