백준알고리즘 1110번 - 더하기 사이클
Contents
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
#include <iostream> #pragma warning(disable:4996) using namespace std; int main(void) { int num, tmp, cnt = 0; cin.tie(NULL); ios_base::sync_with_stdio(false); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif cin >> num; tmp = num; do { tmp = ((tmp % 10) * 10) + (tmp%10 + tmp/10)%10; cnt++; } while (tmp != num); cout << cnt; #ifndef ONLINE_JUDGE fclose(stdin); fclose(stdout); #endif return 0; } |
Author Jaejin Jang
LastMod 2018-11-26
License Jaejin Jang