알고리즘/완전탐색
[java 백준] 실버 5/ 1476번 날짜계산
Meaning_
2021. 8. 30. 00:13
728x90
반응형
https://www.acmicpc.net/problem/1476
1476번: 날짜 계산
준규가 사는 나라는 우리가 사용하는 연도와 다른 방식을 이용한다. 준규가 사는 나라에서는 수 3개를 이용해서 연도를 나타낸다. 각각의 수는 지구, 태양, 그리고 달을 나타낸다. 지구를 나타
www.acmicpc.net
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
Scanner sc = new Scanner(System.in);
int E = sc.nextInt();
int S = sc.nextInt();
int M = sc.nextInt();
int i = 1;
while (true) {
if (((i - E) % 15 == 0) && ((i - S) % 28 == 0) && ((i - M) % 19 == 0)) {
System.out.println(i);
break;
}
i++;
}
}
}
|
cs |
728x90
반응형