#include <iostream>  
using namespace std;

int main(void)
{
	int input,num=9999,cycle=0,k;
	cin >> input;
	if (input > 99 || input < 0)
		return -1;
	if (input < 10)
		k = input ;
	else
		k = input;
		
	while (!(num == input))
	{
		int a,b,c;
		a = k / 10;
		b = k % 10;
		c = a + b ;
		
		num = b * 10 + c;
		cycle++;

		if (num >= 10)
			k = b * 10 + num % 10;
		else
			k = num;

		num = k;
		//cout << a << '+' << b << '=' << c << "num == " << num << endl;
	}
	
	cout << cycle << endl;
	return 0;

}


 


'알고리즘' 카테고리의 다른 글

백준 C++ 1924번  (0) 2017.08.15
백준 C++ 1546번  (0) 2017.08.15
백준 C++ 1008번  (0) 2017.08.15
백준 C++ 1002번  (0) 2017.08.15
백준 C++ 1001번  (0) 2017.08.15

+ Recent posts