-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ16199.java
More file actions
31 lines (26 loc) Β· 1.18 KB
/
Q16199.java
File metadata and controls
31 lines (26 loc) Β· 1.18 KB
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
/**
* Date: 2018. 10. 17.
* Author: inhyuck | https://github.com/inhyuck
* Solution URL: https://github.com/inhyuck/problem-solving
* Title: λμ΄ κ³μ°νκΈ°
* description: λ§ λμ΄, μΈλ λμ΄, μ° λμ΄ κ³μ°νκΈ°
* Problem URL: https://www.acmicpc.net/problem/16199
*/
package io.inhyuck.basic;
import java.time.LocalDate;
import java.util.Scanner;
public class Q16199 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
LocalDate birthday = LocalDate.of(scanner.nextInt(), scanner.nextInt(), scanner.nextInt());
LocalDate nowDate = LocalDate.of(scanner.nextInt(), scanner.nextInt(), scanner.nextInt());
LocalDate temp = nowDate.withYear(birthday.getYear()); //μ°λλ₯Ό λμΌνκ² μ€μ ν μμκ°μ²΄ μμ±
//λ§ λμ΄
System.out.println(nowDate.getYear() - birthday.getYear() - 1 +
(temp.isEqual(birthday) || temp.isAfter(birthday) ? 1 : 0)); //μμΌμ΄κ±°λ μ΄ν λ μ§λ©΄ + 1
//μΈλ λμ΄
System.out.println(nowDate.getYear() - birthday.getYear() + 1);
//μ° λμ΄
System.out.println(nowDate.getYear() - birthday.getYear());
}
}