-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathP10070.java
58 lines (51 loc) · 1.5 KB
/
P10070.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
58
import java.io.*;
import java.math.BigInteger;
public class P10070 {
private static BigInteger b4 = BigInteger.valueOf(4);
private static BigInteger b100 = BigInteger.valueOf(100);
private static BigInteger b400 = BigInteger.valueOf(400);
private static BigInteger b15 = BigInteger.valueOf(15);
private static BigInteger b55 = BigInteger.valueOf(55);
private static boolean divides(BigInteger nom, BigInteger denom) {
return nom.equals(nom.divide(denom).multiply(denom));
}
private static boolean leap(BigInteger y) {
if(!divides(y, b4))
return false;
if(!divides(y, b100))
return true;
return divides(y, b400);
}
private static boolean h(BigInteger y) {
return divides(y, b15);
}
private static boolean b(BigInteger y) {
return leap(y) && divides(y, b55);
}
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String line;
boolean first = true;
while(null != (line = br.readLine())) {
if(!first)
System.out.println();
first = false;
BigInteger N = new BigInteger(line.trim());
boolean any = false;
if(leap(N)) {
System.out.println("This is leap year.");
any = true;
}
if(h(N)) {
System.out.println("This is huluculu festival year.");
any = true;
}
if(b(N)) {
System.out.println("This is bulukulu festival year.");
any = true;
}
if(!any)
System.out.println("This is an ordinary year.");
}
}
}