Search

더하기 사이클

Created
2021/03/23 01:58
문제 번호
1110
카테고리
수학
구현

Memo

Code

제출 날짜

@2/17/2019

메모리

1984 KB

시간

0 ms
#include <iostream> int main() { int count = 0; int val; int half_lft; int half_rht; int temp; std::cin >> val; temp = val; while(1) { half_lft = temp / 10; half_rht = temp % 10; temp = half_rht; half_rht = (half_lft + half_rht) % 10; half_lft = temp; temp = (half_lft * 10 + half_rht); count++; if(temp == val) break; } std::cout << count; return 0; }
C++
복사