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

Code

/**
 * Datatähti 2021 loppu
 * 358
 * A
 *
 * @author TRS
 */
//Include
#include <bits/stdc++.h>
//Definitions
using namespace std;
//Constants
#define infinity 0x3f3f3f3f
#define linfinity 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
int t;
unsigned long long n;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin>>t;
    for (int _ = 0; _ < t; _++) {
        cin>>n;
        if (n < 9) {
            cout<<(n + 1)<<"\n";
        }
        else if (n < 11) {
            cout<<11<<"\n";
        }
        else {
            int maxPowerOf10 = floor(log10(n));
            short firstDigit = floor(n / pow(10, maxPowerOf10));
            short secondDigit = (int)floor(n / pow(10, maxPowerOf10 - 1)) % 10;
            if (firstDigit > secondDigit) {
                for (int d = 0; d <= maxPowerOf10; d++) {
                    cout<<firstDigit;
                }
            }
            else {
                for (int d = 0; d <= maxPowerOf10; d++) {
                    cout<<secondDigit;
                }
            }
            cout<<"\n";
        }
    }
    return 0;
}

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
777777777777777777
777777777777777777
666666666666666666
111111111111111111
777777777777777777
...