Information
- ID
- 1794
- Time
- 1000ms
- Memory
- 512MiB
- Difficulty
- 10
- Tags
- # Submissions
- 1
- Accepted
- 1
- Uploaded By
#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;
}
By signing up a 追梦算法网 universal account, you can submit code and join discussions in all online judging services provided by us.