Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.math.BigInteger;
- import java.util.Scanner;
- public class Main {
- public static final BigInteger BI4 = new BigInteger("4");
- public static final BigInteger BI100 = new BigInteger("100");
- public static final BigInteger BI400 = new BigInteger("400");
- public static final BigInteger BI15 = new BigInteger("15");
- public static final BigInteger BI55 = new BigInteger("55");
- public static final String LEAPS = "This is leap year.";
- public static final String HULUS = "This is huluculu festival year.";
- public static final String BULUS = "This is bulukulu festival year.";
- public static final String ORDS = "This is an ordinary year.";
- public static void main(String[] args) {
- Scanner s = new Scanner(System.in);
- BigInteger ano;
- boolean bissexto;
- boolean huluculu;
- boolean bulukulu;
- boolean primeiro = true;
- while (s.hasNext()) {
- if (primeiro == true) {
- primeiro = false;
- } else {
- System.out.println("");
- }
- ano = new BigInteger(s.nextLine());
- bissexto = false;
- huluculu = false;
- bulukulu = false;
- if (((ano.remainder(BI4).compareTo(BigInteger.ZERO) == 0)
- && (!(ano.remainder(BI100).compareTo(BigInteger.ZERO) == 0)))
- || (ano.remainder(BI400).compareTo(BigInteger.ZERO) == 0)) {
- System.out.println(LEAPS);
- bissexto = true;
- }
- if (ano.remainder(BI15).compareTo(BigInteger.ZERO) == 0) {
- System.out.println(HULUS);
- huluculu = true;
- }
- if (bissexto && (ano.remainder(BI55).compareTo(BigInteger.ZERO) == 0)) {
- System.out.println(BULUS);
- bulukulu = true;
- }
- if (!bissexto && !huluculu && !bulukulu) {
- System.out.println(ORDS);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement