#15596
#include <iostream>
#include <vector>
using namespace std;
long long sum(vector<int> &a) {
long long ans = 0;
for (int i = 0; i < a.size(); i++)
{
ans += a[i];
}
return ans;
}
#4673
#include <iostream>
using namespace std;
int d(int n) { //생성자가 있는 셀프넘버
int sum = n;
while (n > 0)
{
sum = sum + n % 10;
n /= 10;
}
return sum;
}
int main()
{
int data[10001] = {0};
int X;
for (int i = 1; i < 10001; i++)
{
X = d(i);
if (X < 10001)
{
data[X] = 1;
}
}
for (int i = 1; i < 10001; i++)
{
if (data[i] != 1)
{
cout << i << "\n";
}
}
}
#1065
#include <iostream>
using namespace std;
int hansu(int m)
{
int x, y, z = 0;
int cnt = 0;
for (int i = 100; i <= m; i++) {
x = i / 100; //백의자리
y = (i % 100) / 10; //십의자리
z = (i % 100) % 10; //일의자리
if (x - y == y - z)
{
cnt++;
}
}
return cnt;
}
int main()
{
int N, result;
cin >> N;
if (N > 1000)
return 0;
if (N < 100)
{
cout << N;
}
else
{
result = hansu(N);
cout << result + 99;
}
return 0;
}