본문 바로가기

Programming/BaekJoon

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



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;


}