• This project
    • Loading...
  • Sign in

김성수 / Algorithm_Study

%ea%b7%b8%eb%a6%bc1
Go to a project
Toggle navigation Toggle navigation pinning
  • Projects
  • Groups
  • Snippets
  • Help
  • Project
  • Activity
  • Repository
  • Pipelines
  • Graphs
  • Issues 0
  • Merge Requests 0
  • Wiki
  • Snippets
  • Network
  • Create a new issue
  • Builds
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Network
  • Compare
  • Branches
  • Tags
Switch branch/tag
  • Algorithm_Study
  • 1학기
  • Week02
  • lab01
  • main.cpp
  • korkeep's avatar
    Week01(for beginners) · 46eae144
    46eae144 Browse Files
    korkeep authored 2019-10-08 14:42:28 +0900
main.cpp 396 Bytes
Raw Blame History Permalink
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
#include<iostream>
using namespace std;

int main() {

	int temp, input, count, fNum, bNum;
	fNum = bNum = temp = input = count = 0;

	cin >> input;
	temp = input;

	while (temp != input || count == 0) {
		count++;
		fNum = temp / 10;
		bNum = temp % 10;
		temp = fNum + bNum;
		if (temp < 10)
			temp += bNum * 10;
		else
			temp = temp % 10 + bNum * 10;
	}
	cout << count << endl;

	return 0;
}