-
Notifications
You must be signed in to change notification settings - Fork 457
/
Copy pathSolution.go
43 lines (35 loc) Β· 876 Bytes
/
Solution.go
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
package main
import "fmt"
func fineCalculator(actualDay, actualMonth, actualYear, expectedDay, expectedMonth, expectedYear int) int {
if actualYear < expectedYear {
return 0
}
if actualYear > expectedYear {
return 10000
}
if actualMonth < expectedMonth {
return 0
}
if actualMonth > expectedMonth {
return (actualMonth - expectedMonth) * 500
}
if actualDay < expectedDay {
return 0
}
if actualDay > expectedDay {
return (actualDay - expectedDay) * 15
}
return 0
}
func main() {
var actualDay, actualMonth, actualYear int
var expectedDay, expectedMonth, expectedYear int
fmt.Scan(&actualDay)
fmt.Scan(&actualMonth)
fmt.Scan(&actualYear)
fmt.Scan(&expectedDay)
fmt.Scan(&expectedMonth)
fmt.Scan(&expectedYear)
result := fineCalculator(actualDay, actualMonth, actualYear, expectedDay, expectedMonth, expectedYear)
fmt.Println(result)
}