CSES - Datatähti Open 2021 - Results
Submission details
Task:Greater Integers
Sender:etaha
Submission time:2021-01-31 14:31:08 +0200
Language:C++ (C++11)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED35
#2ACCEPTED65
Test results
testverdicttimegroup
#1ACCEPTED0.01 s1, 2details
#2ACCEPTED0.01 s2details

Compiler report

input/code.cpp: In function 'void solve()':
input/code.cpp:38:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=1;i<n.size();i++){
          ~^~~~~~~~~
input/code.cpp:45:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(i=0;i<n.size();i++) cout<<n[0];
           ~^~~~~~~~~
input/code.cpp:49:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(i=0;i<n.size();i++) cout<<(char)(n[0]+1);
            ~^~~~~~~~~
input/code.cpp:52:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(i=0;i<=n.size();i++) cout<<1;
            ~^~~~~~~~~~
input/code.cpp:34:9: warning: unused variable 'j' [-Wunused-variable]
  lint i,j,k;
         ^
input/code.cpp:34:11: warning: unused variable 'k' [-Wunused-variable]
  lint i,j,k;
           ^

Code

//debug icin gdb kullanmayi dene
#include<bits/stdc++.h>
using namespace std;
#define mods 1000000007
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define rs resize
#define pii pair<lint,lint> 
#define piii pair<lint,pair<lint,lint> > 
#define inf LLONG_MAX-7
#define vvL vector<vector<lint> > 
#define vvB vector<vector<bool> > 
#define vvvL vector<vector<vector<lint> > > 
#define vL vector<lint> 
#define vpii vector<pii> 
#define vB vector<bool> 
typedef long long int lint;
typedef unsigned long long int ulint;
lint fastpow(lint tab,lint us){
	if(tab==0) return 0;
	if(tab==1) return 1;
	if(us==0) return 1;
	if(us==1) return tab%mods;
	tab%=mods;
	if(us%2==1) return tab*fastpow(tab,us-1)%mods;
	lint a=fastpow(tab,us/2)%mods;
	return a*a%mods;
}
lint t=1;

void solve(){
	lint i,j,k;
	string n;
	cin>>n;
	bool flag=0; 
	for(i=1;i<n.size();i++){
		if(n[i-1]>n[i]){
			flag=1;
			break;
		}else if(n[i-1]<n[i]) break;
	}
	if(flag){
		for(i=0;i<n.size();i++) cout<<n[0];
		cout<<endl;	
	}else{
		if(n[0]!='9'){
			for(i=0;i<n.size();i++) cout<<(char)(n[0]+1);
			cout<<endl;
		}else{
			for(i=0;i<=n.size();i++) cout<<1;
			cout<<endl;
		}
	}




	return;
}

int main(){
//	freopen("in.txt","r",stdin);freopen("out.txt","w",stdout);
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>t;
	while(t--) 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