1 solutions

  • 0
    @ 2023-12-11 17:14:39
    #include <iostream>
    #include <bits/stdc++.h>
    using namespace std;
    int jisu(int a)
    {
    	int s = 1;
    	do{
    		if(a / 10 > 0){
    			s++;
    		}
    		a /= 10;
    	}while(a != 0);
        return (s);
    }
    int pd(int b)
    {
    	int flag = 1;
    	int m = jisu(b);
    	int sum = 3 * b + 3;
    	if(jisu(sum) != m){
    		flag = 0;
    	}
    	return (flag);
    }
    int main()
    {
    	int n;
    	int sum = 0;
    	cin >> n;
    	for(int i = 1 ;i <= n ;i++){
    		int flag = pd(i);
    		if(flag == 1){
    			sum++;
    		}
    	}
    	cout << sum;
    	return 0;
    }
    
    • 1

    Information

    ID
    1794
    Time
    1000ms
    Memory
    512MiB
    Difficulty
    10
    Tags
    # Submissions
    1
    Accepted
    1
    Uploaded By