-
Notifications
You must be signed in to change notification settings - Fork 0
/
Q1476.java
35 lines (32 loc) · 1.1 KB
/
Q1476.java
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
32
33
34
35
package baekjoon.q1000;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class Q1476 {
public static void main(String args[]) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
int e = Integer.parseInt(st.nextToken()); // 1~15
int s = Integer.parseInt(st.nextToken()); // 1~28
int m = Integer.parseInt(st.nextToken()); // 1~19
// 변하는 각 변수 초기화
int te = 1;
int ts = 1;
int tm = 1;
int result = 0;
while(true){
result++; // 년도 증가
// 입력값과 같아진 다면 년도 출력 후 종료
if(e==te&&s==ts&&m==tm){
System.out.println(result);
break;
}
te++; ts++; tm++;
// 각 범위를 넘어서면 1로 초기화
if(te>15) te=1;
if(ts>28) ts=1;
if(tm>19) tm=1;
}
}
}