25802023-01-17 16:18:59kohumarkSzivárványszámokcpp11Time limit exceeded 18/45381ms4888 KiB
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;


int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	ll n; cin >> n;
	int ok=0;
	
	for(ll i=0; i<n; i++){
		string act = to_string(i);
		bool nov=true; bool jo=true;
		for(int j=1; j<(int)act.length(); j++){
			if(nov&&act[j]>=act[j-1]) continue;
			else if(act[j]<=act[j-1]){
				nov=false; continue;
			}
			else{
				jo=false;
				i = ((int)(i/pow(10,act.length()-j))+1)*pow(10,act.length()-j)-1;
				break;
			}
		}
		if(jo) ok++;
	}
	
	cout << ok << '\n';
}
SubtaskSumTestVerdictTimeMemory
base18/45
1Accepted0/03ms1888 KiB
2Accepted0/0171ms2088 KiB
3Time limit exceeded0/0377ms2172 KiB
4Accepted1/12ms2424 KiB
5Accepted1/12ms2632 KiB
6Accepted1/12ms2836 KiB
7Accepted1/12ms2904 KiB
8Accepted1/12ms3016 KiB
9Accepted1/13ms3080 KiB
10Accepted1/13ms3212 KiB
11Accepted1/13ms3288 KiB
12Accepted1/14ms3516 KiB
13Accepted2/257ms3592 KiB
14Accepted2/250ms3720 KiB
15Accepted2/267ms3684 KiB
16Accepted2/271ms3916 KiB
17Accepted1/171ms4120 KiB
18Time limit exceeded0/2370ms4068 KiB
19Time limit exceeded0/2377ms4164 KiB
20Time limit exceeded0/2349ms4392 KiB
21Time limit exceeded0/3375ms4268 KiB
22Time limit exceeded0/2377ms4372 KiB
23Time limit exceeded0/2356ms4496 KiB
24Time limit exceeded0/2358ms4376 KiB
25Time limit exceeded0/2372ms3560 KiB
26Time limit exceeded0/2351ms4600 KiB
27Time limit exceeded0/2381ms4704 KiB
28Time limit exceeded0/2370ms4672 KiB
29Time limit exceeded0/2349ms4780 KiB
30Time limit exceeded0/2372ms4888 KiB