Algorithm/백준
C++ 알고리즘 - 백준 4673 셀프 넘버
마루설아
2025. 1. 19. 22:17
https://www.acmicpc.net/problem/4673
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
int arr[11111];
int self(int n) {
return n +
(n / 10000) +
(n % 10000 / 1000) +
(n % 1000 / 100) +
(n % 100 / 10) +
(n % 10 / 1);
}
void CPP_INIT() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int main(void) {
CPP_INIT();
for (int i = 1; self(i) < 11111; i++) {
arr[self(i)]++;
}
for (int i = 1; i <= 10000; i++) {
if (arr[i] == 0) cout << i << endl;
}
}