25222023-01-15 18:25:11kohumarkSzivárványszámokcpp11Time limit exceeded 18/45377ms4716 KiB
#include <iostream>
#include <cmath>
#define ll long long
using namespace std;


int main(){
	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';
	// for(int i=0; i<10; i++) cout << (int)(to_string(i)[0]) << '\n';
}
SubtaskSumTestVerdictTimeMemory
base18/45
1Accepted0/03ms1876 KiB
2Accepted0/0165ms2064 KiB
3Time limit exceeded0/0360ms1424 KiB
4Accepted1/12ms2668 KiB
5Accepted1/12ms2836 KiB
6Accepted1/12ms2804 KiB
7Accepted1/12ms2828 KiB
8Accepted1/12ms3040 KiB
9Accepted1/13ms3100 KiB
10Accepted1/13ms3240 KiB
11Accepted1/13ms3300 KiB
12Accepted1/14ms3304 KiB
13Accepted2/254ms3300 KiB
14Accepted2/248ms3428 KiB
15Accepted2/265ms3564 KiB
16Accepted2/268ms3648 KiB
17Accepted1/170ms3880 KiB
18Time limit exceeded0/2375ms3168 KiB
19Time limit exceeded0/2365ms3884 KiB
20Time limit exceeded0/2365ms3884 KiB
21Time limit exceeded0/3365ms3360 KiB
22Time limit exceeded0/2358ms4332 KiB
23Time limit exceeded0/2377ms3584 KiB
24Time limit exceeded0/2361ms4656 KiB
25Time limit exceeded0/2372ms4716 KiB
26Time limit exceeded0/2358ms4620 KiB
27Time limit exceeded0/2356ms4624 KiB
28Time limit exceeded0/2370ms4488 KiB
29Time limit exceeded0/2361ms4592 KiB
30Time limit exceeded0/2370ms4716 KiB