Programming/BaekJoon

[C++] 백준 1110번 : 더하기 사이클

TCBE 2019. 2. 19. 17:00



https://www.acmicpc.net/problem/1110




#include <iostream>

using namespace std;

int main() {

int n;

cin >> n;

int next = n, cnt = 0;

do

{

cnt++;

next = next % 10 * 10 + (next / 10 + next % 10) % 10;

} while (n != next);

cout << cnt << endl;


}