사생활 보호 설정
https://gamjia.tistory.com
Updated News
Mini Rooms
답글수 [0]
What Friends Say
한마디로 표현해봐~
1촌평 관리
4673번 셀프 넘버
GamJia 2023. 3. 24. 09:10
단계별로 풀어보기 - 함수 - 2단계
https://www.acmicpc.net/problem/4673
#include <iostream> using namespace std; int d(int n) { int temp=n; while(n!=0) { temp+=n%10; // 원래 숫자+십의 자리 숫자+일의 자리 숫자 n=n/10; } return temp; } bool arr[10001]; int main() { for(int i=1;i<=10000;i++) { int x=d(i); if(x<=10001) { arr[x]=true; } } for(int i=1;i<=10000;i++) { if(!arr[i]) { cout<<i<<endl; } } return 0; }