General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
115570147 Practice:
start_code_end
1520B - 8 GNU C++14 Time limit exceeded on test 2 2000 ms 3640 KB 2021-05-07 18:20:17 2021-05-07 18:20:17
 
 
→ Source
#include <bits/stdc++.h>
using namespace std;

int is_ord(long long int a)
{
    string num = "" + to_string(a);
    if (count(num.begin(),num.end(),num[0]) != num.size())
    {
        return 0;
    }
    return 1;
}

int main(void)
{
    int t;
    cin >> t;

    while (t--)
    {
        long long int n;
        cin >> n;

        long long int count = 0, j = 1;
        while (j <= n)
        {
            if ((j < 10 && j > 0) || is_ord(j) == 1)
            {
                count++;
            }
            j++;
        }

        cout << count << endl;
    }
}
 
 
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details