| Task: | Greater Integers |
| Sender: | Black_hat |
| Submission time: | 2021-01-30 07:52:23 +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 'int main()':
input/code.cpp:40:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(i=0;i<vc.size();i++){
~^~~~~~~~~~
input/code.cpp:45:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(j=1;j<vc.size();j++){
~^~~~~~~~~~
input/code.cpp:53:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(i<vc.size()){
~^~~~~~~~~~
input/code.cpp:59:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(i<vc.size()){
~^~~~~~~~~~
input/code.cpp:64:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
else if(i<vc.size()){
~^~~~~~~~~~
input/code.cpp:66:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
while(i<vc.size()){
~^~~~~~~~~~
input/code.cpp...Code
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 100005
#define endl "\n"
#define mod 1000000007
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//----------------------------------------------
int main(){
ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int t;
cin>>t;
while(t--){
ll i,j,k,l,n;
cin>>n;
vector<ll> vc;
k=n;
while(k>0){
vc.ps(k%10);
k=k/10;
}reverse(all(vc));
for(i=0;i<vc.size();i++){
if(vc[i]!=9) break;
}
if(i==0){
k=0;
for(j=1;j<vc.size();j++){
if(vc[j]<vc[i]){
k=1; break;
}
if(vc[j]>vc[i]) break;
}
if(k){
k=vc[i];i=0;
while(i<vc.size()){
cout<<k; i++;
}cout<<endl;
}
else{
k=vc[i]+1;i=0;
while(i<vc.size()){
cout<<k; i++;
}cout<<endl;
}
}
else if(i<vc.size()){
i=0;
while(i<vc.size()){
cout<<"9"; i++;
}cout<<endl;
}
else{
for(i=0;i<=vc.size();i++){
cout<<"1";
}cout<<endl;
}
}
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 |
