forked from RyanFehr/HackerRank
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolution.java
57 lines (48 loc) · 1.73 KB
/
Solution.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//Problem: https://www.hackerrank.com/challenges/linkedin-practice-nested-logic
//Java 8
/*
Initial Thoughts:
We can solve this problem by simply using
a if statement that narrows down our checks
at each step to calculate the proper fine
Time Complexity: O(1); //Add return dates take the same amount of time
Space Complexity: O(1); //No dynamically allocated variables
*/
import java.io.*;
import java.util.*;
public class Solution {
public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner input = new Scanner(System.in);
int returnDay = input.nextInt();
int returnMonth = input.nextInt();
int returnYear = input.nextInt();
int expectedDay = input.nextInt();
int expectedMonth = input.nextInt();
int expectedYear = input.nextInt();
int hackosFine = 0;
//if statement that checks starting at the years and proceeds based on equivalence
//Year is off - 10,000 hackos
//Month is off - months * 500 hackos
//Day is off - days * 15 hackos
if(expectedYear < returnYear)
{
hackosFine = 10000;
}
else if(expectedYear == returnYear )
{
if(expectedMonth < returnMonth)
{
hackosFine = (returnMonth-expectedMonth) * 500;
}
else if(expectedMonth == returnMonth)
{
if(expectedDay < returnDay)
{
hackosFine = (returnDay - expectedDay) * 15;
}
}
}
System.out.println(hackosFine);
}
}