BOJ 2577 숫자의 개수 (C++) #include using namespace std; int main() { int x,y,z; cin >> x >> y >> z; int t=x*y*z,ans[10]={0,0,0,0,0,0,0,0,0,0}; while(t!=0) { ans[t-(t/10)*10]++; t/=10; } for (int i=0;i 코딩/C++ 2021.08.01
BOJ 11720 숫자의합 (C++) #include using namespace std; int main() { int n; int ans=0; for (scanf("%d",&n);n>0;n--) { int x; scanf("%1d",&x); ans+=x; } cout 코딩/C++ 2021.07.31
BOJ 1110 더하기 사이클 (C++) 그냥 써있는대로 하면끝 #include using namespace std; int main() { int n; cin >> n; int t=n,ans=0; while(1) { int tt,sum; if (t/10==0) tt=t*10; else tt=t; sum=tt/10+tt%10; t=(t%10)*10+sum%10; //printf("t%d tt%d sum%d\n",t,tt,sum); ans++; if (t==n) break; } cout 코딩/C++ 2021.07.31