CSES - Datatähti 2021 loppu - Results
Submission details
Task:Suuremmat
Sender:Eljas
Submission time:2021-01-23 17:09:25 +0200
Language:C++17
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
Test results
testverdicttimegroup
#10.01 s1, 2details
#20.01 s2details

Code

#include <iostream>
#include <vector>
#include <string>
int main()
{
	 int n = 0;
	 std::cin >> n;

	 std::vector<int> vec(n);
	 for (int i = 0; i < n; i++)
	 {
		  std::cin >> vec[i];
	 }


	 std::string s;
	 char first;
	 int length;
	 int nineLength;
	 bool increase;

	 for (int i = 0; i < n; i++)
	 {


		  s = std::to_string(vec[i]);
		  length = s.size();
		  first = s[0] - '0';
		  nineLength = first == 9;
		  increase = length == 1;

		  int j = 1;


		  while (s[j] == 9 && j < length)
		  {
				nineLength++;
				j++;
		  }
		  if (nineLength == length)
		  {
				for (int j = 0; j < length + 1; j++) {
					 std::cout << '1';
				}
		  }
		  else
		  {
				while (j < length)
				{
					 if (s[j]-'0' > first)
					 {
						  increase = true;
					 }
					 j++;
				}
				std::string s2;
				if (increase)
				{
					 s2 = std::to_string(first + 1);

				}
				else
				{
					 s2 = std::to_string(first);
				}
				for (int j = 0; j < length; j++)
				{
					 std::cout << s2;
				}

		  }
		  std::cout << '\n';
	 }




}

Test details

Test 1

Group: 1, 2

Verdict:

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:

input
1000
735425311146082632
756615631808964686
466489470801941584
100417544394053220
...

correct output
777777777777777777
777777777777777777
555555555555555555
111111111111111111
555555555555555555
...

user output
3333333333
1
1
1
1
...