| Task: | Greater Integers |
| Sender: | f1x9d |
| Submission time: | 2021-01-30 13:22:14 +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 |
Compiler report
input/code.cpp: In function 'void solve()':
input/code.cpp:44:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i <= vec.size(); i ++) cur = cur * 10 + vec[0];
~~^~~~~~~~~~~~~
input/code.cpp:47:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int i = 1; i <= vec.size(); i ++) cur = cur * 10 + vec[0] + 1;
~~^~~~~~~~~~~~~
input/code.cpp: At global scope:
input/code.cpp:50:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
main () {
^Code
#include <bits/stdc++.h>
//#pragma GCC optimize "O3"
///if ((double) ((double)(clock() - cl)/(double)CLOCKS_PER_SEC)>1.85) { break;}
#include <ext/pb_ds/assoc_container.hpp>
#define int long long
#define double long double
#define ft first
#define sc second
#define pb push_back
#define e '\n'
#define booost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cerr.tie(0);
#define all(x) (x).begin(),(x).end()
#define file(x) freopen(string(string((x)) + ".in").c_str(), "r", stdin); freopen(string(string((x)) + ".out").c_str(), "w", stdout);
#define GG cout << " OPA " << '\n';
using namespace std;
using namespace __gnu_pbds;
typedef pair <int, int> pi;
typedef tree <pi, null_type, less<pi>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const int N = 20 + 5;
const int K = 10;
const int KK = 20;
const int INF = 1e18;
const double d_INF = 2000000000.0;
const double EPS = 1e-17;
const int MOD = 1e9 + 7;
const int LOG = 30;
void solve() {
int n;
cin >> n;
n ++;
int nn = n;
vector <int> vec;
while (n > 0) {
vec.pb(n % 10);
n /= 10;
}
reverse(all(vec));
int cur = 0;
for (int i = 1; i <= vec.size(); i ++) cur = cur * 10 + vec[0];
if (cur >= nn) {cout << cur << '\n'; return;}
cur = 0;
for (int i = 1; i <= vec.size(); i ++) cur = cur * 10 + vec[0] + 1;
cout << cur << '\n';
}
main () {
int test = 1;
booost;
cin >> test;
while (test --) {
solve();
}
}
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 |
