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 |
Tags
- 팔로잉 끊기 구현
- godotenv
- 백준 알고리즘
- Node.js교과서
- C++ 시간 초과
- 람다 함수 이름 변경
- C++ Fast I/O
- 깃허브 clone
- 람다 함수 이름 변경 안됨
- http 모듈
- node.js 교과서
- 깃허브 코드 업로드
- go 환경변수
- 열혈 C++
- 출력형식 오류 해결
- node.js
- github pull
- 깃허브 pull
- go .env
- GitHub 업로드
- 백준 2443
- C++ 입출력
- 깃허브 협업
- 라우팅 연결하기
- lambda 이름 변경
- 깃허브
- 깃허브 복제
- C++
- aws lambda 함수
- 백준
Archives
- Today
- Total
만능재주꾼
[백준 1110] 더하기 사이클 - JAVA (do-while문 사용) 본문
문제
풀이 포인트
- 입력받은 숫자의 십의 자리와 일의 자리를 분리하기 위해 몫과 나머지 구하기
- while문이 반복되는 횟수로 사이클 구하기
풀이
import java.io.*;
public class Main {
public static void main(String[] args)throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));
int s = Integer.parseInt(br.readLine());
int num = s;
int i = 0;
do {
int n1 = num/10;
int n2 = num%10;
int n3 = (n1 + n2)%10;
num = n2*10 + n3;
i++;
}while (num != s);
bw.write(i+"\n");
br.close(); bw.flush(); bw.close();
}
}
'💻 Algorithm > BOJ' 카테고리의 다른 글
[백준 8958] OX퀴즈 - JAVA (0) | 2021.01.04 |
---|---|
[백준 2577] 숫자의 개수 - JAVA (0) | 2021.01.02 |
[백준 3052] 나머지 - JAVA (Vector 사용) (0) | 2020.12.31 |
[백준 2739] 구구단 - JAVA (for문 사용) (0) | 2020.12.26 |
[백준 10845] 큐 - JAVA (0) | 2020.12.26 |
Comments