28532023-01-30 10:21:30AbbenceSzivárványszámokcpp17Wrong answer 1/45400ms4952 KiB
//95%-ban ChatGPT által készített kód

#include <iostream>
#include <string>

using namespace std;

bool isRainbowNumber(int number) {
    string str = to_string(number);
    int size = str.size();
    int breakPoint = 0;
    for (int i = 0; i < size - 1; i++) {
        if (str[i] < str[i + 1]) {
            breakPoint = i + 1;
        } else {
            break;
        }
    }
    for (int i = 0; i < breakPoint; i++) {
        if (str[i] >= str[i + 1]) {
            return false;
        }
    }
    for (int i = breakPoint; i < size - 1; i++) {
        if (str[i] <= str[i + 1]) {
            return false;
        }
    }
    return true;
}

int main() {
    int n;
    cin >> n;
    int count = 0;
    for (int i = 0; i < n; i++) {
        if (isRainbowNumber(i)) {
            count++;
        }
    }
    cout << count << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base1/45
1Wrong answer0/03ms1876 KiB
2Time limit exceeded0/0400ms2092 KiB
3Time limit exceeded0/0368ms2208 KiB
4Accepted1/12ms2412 KiB
5Wrong answer0/12ms2652 KiB
6Wrong answer0/12ms2836 KiB
7Wrong answer0/12ms2916 KiB
8Wrong answer0/13ms3156 KiB
9Wrong answer0/13ms3268 KiB
10Wrong answer0/14ms3280 KiB
11Wrong answer0/16ms3440 KiB
12Wrong answer0/18ms3644 KiB
13Time limit exceeded0/2400ms3260 KiB
14Time limit exceeded0/2372ms4148 KiB
15Time limit exceeded0/2365ms3268 KiB
16Time limit exceeded0/2340ms4200 KiB
17Time limit exceeded0/1352ms3708 KiB
18Time limit exceeded0/2384ms4416 KiB
19Time limit exceeded0/2345ms4480 KiB
20Time limit exceeded0/2342ms4476 KiB
21Time limit exceeded0/3372ms4600 KiB
22Time limit exceeded0/2365ms4732 KiB
23Time limit exceeded0/2340ms4628 KiB
24Time limit exceeded0/2365ms4880 KiB
25Time limit exceeded0/2365ms4936 KiB
26Time limit exceeded0/2361ms4692 KiB
27Time limit exceeded0/2384ms4812 KiB
28Time limit exceeded0/2368ms4928 KiB
29Time limit exceeded0/2381ms4952 KiB
30Time limit exceeded0/2344ms4812 KiB