CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:intoo
Submission time:2021-01-23 16:13:46 +0200
Language:C++17
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 'int main()':
input/code.cpp:13:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i = 1; i < n.size(); ++i) {
                   ~~^~~~~~~~~~
input/code.cpp:24:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i <= n.size(); ++i)
                     ~~^~~~~~~~~~~
input/code.cpp:28:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < n.size(); ++i)
                     ~~^~~~~~~~~~

Code

#include <iostream>

using namespace std;
using ll = long long;

int main() {
	int t;
	string n;
	cin >> t;
	while (t --> 0) {
		cin >> n;
		int k = -1;
		for (int i = 1; i < n.size(); ++i) {
			if (n[i-1] > n[i]) {
				k = n[0]-'0';
				break;
			} else if (n[i-1] < n[i]) {
				k = n[0]-'0'+1;
				break;
			}
		}
		if (k == -1) {
			if (n[0] == '9') {
				for (int i = 0; i <= n.size(); ++i)
					cout << 1;
				cout << endl;
			} else {
				for (int i = 0; i < n.size(); ++i)
					cout << n[0]-'0'+1;
				cout << endl;
			}
		} else {
			int s = n.size();
			if (k == 10) {
				k = 1;
				++s;
			}
			for (int i = 0; i < s; ++i)
				cout << k;
			cout << endl;
		}
	}
}

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
...

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
555555555555555555
...