250x250
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 |
Tags
- 주사위굴리기2
- 알고리즘
- 백준13458
- Bfs와DFS
- 에라토스테네스의채
- 정올 1620
- 파티션 크기 조정
- 전화번호속의암호
- 중복순열
- 알고리즘개념
- 완탐
- 삼성역테
- 23288
- 코테
- 순열
- 자바 코테
- 정보처리기사
- 자바
- 볼륨 만들기
- 백준15652
- D드라이브생성
- 백준2251
- java
- BFS
- 완전탐색
- 중복조합
- N과M
- 코테준비
- 재귀함수
- 백준
Archives
- Today
- Total
목록더하기사이클 (1)
뚱땅뚱땅
![](http://i1.daumcdn.net/thumb/C150x150/?fname=https://blog.kakaocdn.net/dn/IBR9G/btqT7VwU2Do/u40iVPlV0zTq7F7F2wVDA0/img.png)
* 단계별로 풀어보기: while 문 문제 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int cycle = 0; int tmp = n, sum = 0; while(true) { if(n99) break; sum = (tmp/10) + (tmp%10); tmp = (tmp%10)*10 + (sum%10); cycle++; if(n == tmp) break; } System.out.println(cycle); } }
알고리즘/백준
2021. 1. 19. 14:52