Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- OS
- coding
- Stack
- 구현
- Operating System
- 브루트포스
- 컴퓨터공학과
- 너비우선탐색
- 코테
- DP
- 자료구조
- c++
- 그래프
- 코딩
- 백준
- 오에스
- 북리뷰
- 개발
- 컴공
- vector
- 오퍼레이팅시스템
- 문제풀이
- 컴공과
- Computer science
- cs
- 정석학술정보관
- 정석
- 알고리즘
- 스택
- bfs
Archives
- Today
- Total
Little Jay
[C++] 백준 1110번 - 더하기 사이클 본문
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int number, result;
int x, y, z, w;
int count = 0;
cin >> number;
result = number;
while (true) {
x = number / 10;
y = number % 10;
z = (x + y) % 10;
w = (y * 10) + z;
number = w;
count++;
if (w == result)
break;
}
cout << count << "\n";
return 0;
}
'알고리즘 > BOJ' 카테고리의 다른 글
[C++] 백준 1065번 - 한수 (0) | 2021.09.05 |
---|---|
[C++] 백준 5052번 - 전화번호 목록 (0) | 2021.09.04 |
[C++] 백준 1789번 - 수들의 합 (0) | 2021.09.02 |
[C++] 백준 2512번 - 예산 (0) | 2021.09.02 |
[C++] 백준 5622번 - 다이얼 (0) | 2021.09.02 |
Comments