-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathLibraryFine.cpp
55 lines (39 loc) · 1.38 KB
/
LibraryFine.cpp
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.regex.*;
public class Solution {
// Complete the libraryFine function below.
static int libraryFine(int d1, int m1, int y1, int d2, int m2, int y2) {
if(y1 > y2) {
return 10000;
}
if(y1 == y2 && m1 > m2) {
return 500*(m1-m2);
}
if(y1 == y2 && m1 == m2 && d1 > d2) {
return 15*(d1-d2);
}
return 0;
}
private static final Scanner scanner = new Scanner(System.in);
public static void main(String[] args) throws IOException {
BufferedWriter bufferedWriter = new BufferedWriter(new FileWriter(System.getenv("OUTPUT_PATH")));
String[] d1M1Y1 = scanner.nextLine().split(" ");
int d1 = Integer.parseInt(d1M1Y1[0]);
int m1 = Integer.parseInt(d1M1Y1[1]);
int y1 = Integer.parseInt(d1M1Y1[2]);
String[] d2M2Y2 = scanner.nextLine().split(" ");
int d2 = Integer.parseInt(d2M2Y2[0]);
int m2 = Integer.parseInt(d2M2Y2[1]);
int y2 = Integer.parseInt(d2M2Y2[2]);
int result = libraryFine(d1, m1, y1, d2, m2, y2);
bufferedWriter.write(String.valueOf(result));
bufferedWriter.newLine();
bufferedWriter.close();
scanner.close();
}
}