25282023-01-16 13:16:22zsebiSzivárványszámokcpp11Time limit exceeded 2/45400ms4768 KiB
// szivarvanyszamok.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <queue>
#include <string>

#define ll long long
using namespace std;

ll i, n;
bool ok, ok2 = false;
int main()
{
    cin >> n;
    i = 0;
    ll db = 0;
    
    while (i < n)
    {
        ok = ok2 = false;
        string s = to_string(i);
        for (int j=1;j<s.size();++j)
        {
            if (s[j] >= s[j - 1])
                ok = true;
            else if (s[j] < s[j - 1] && ok)
            {
                ok2 = true;
                break;
            }
        }
        ++i;
        if (!ok2)db++;
    }
    cout << db;
    return 0;
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base2/45
1Accepted0/03ms1880 KiB
2Time limit exceeded0/0400ms1200 KiB
3Time limit exceeded0/0344ms2264 KiB
4Accepted1/12ms2536 KiB
5Accepted1/12ms2736 KiB
6Wrong answer0/12ms2812 KiB
7Wrong answer0/12ms3064 KiB
8Wrong answer0/13ms3012 KiB
9Wrong answer0/13ms3228 KiB
10Wrong answer0/14ms3308 KiB
11Wrong answer0/14ms3388 KiB
12Wrong answer0/16ms3380 KiB
13Time limit exceeded0/2363ms3252 KiB
14Time limit exceeded0/2365ms3252 KiB
15Time limit exceeded0/2368ms3256 KiB
16Time limit exceeded0/2358ms3480 KiB
17Time limit exceeded0/1349ms3716 KiB
18Time limit exceeded0/2370ms3824 KiB
19Time limit exceeded0/2333ms3800 KiB
20Time limit exceeded0/2333ms3016 KiB
21Time limit exceeded0/3400ms4028 KiB
22Time limit exceeded0/2377ms4108 KiB
23Time limit exceeded0/2365ms4108 KiB
24Time limit exceeded0/2377ms4004 KiB
25Time limit exceeded0/2377ms4232 KiB
26Time limit exceeded0/2361ms4436 KiB
27Time limit exceeded0/2377ms4644 KiB
28Time limit exceeded0/2356ms4768 KiB
29Time limit exceeded0/2400ms4728 KiB
30Time limit exceeded0/2361ms4724 KiB