Advertisement
Riposati

Untitled

Sep 28th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.05 KB | None | 0 0
  1. import java.math.BigInteger;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6.     public static final BigInteger BI4 = new BigInteger("4");
  7.     public static final BigInteger BI100 = new BigInteger("100");
  8.     public static final BigInteger BI400 = new BigInteger("400");
  9.     public static final BigInteger BI15 = new BigInteger("15");
  10.     public static final BigInteger BI55 = new BigInteger("55");
  11.     public static final String LEAPS = "This is leap year.";
  12.     public static final String HULUS = "This is huluculu festival year.";
  13.     public static final String BULUS = "This is bulukulu festival year.";
  14.     public static final String ORDS = "This is an ordinary year.";
  15.  
  16.     public static void main(String[] args) {
  17.  
  18.         Scanner s = new Scanner(System.in);
  19.         BigInteger ano;
  20.         boolean bissexto;
  21.         boolean huluculu;
  22.         boolean bulukulu;
  23.         boolean primeiro = true;
  24.  
  25.         while (s.hasNext()) {
  26.  
  27.             if (primeiro == true) {
  28.                 primeiro = false;
  29.             } else {
  30.                 System.out.println("");
  31.             }
  32.            
  33.             ano = new BigInteger(s.nextLine());
  34.             bissexto = false;
  35.             huluculu = false;
  36.             bulukulu = false;
  37.                        
  38.             if (((ano.remainder(BI4).compareTo(BigInteger.ZERO) == 0)
  39.                     && (!(ano.remainder(BI100).compareTo(BigInteger.ZERO) == 0)))
  40.                     || (ano.remainder(BI400).compareTo(BigInteger.ZERO) == 0)) {
  41.                 System.out.println(LEAPS);
  42.                 bissexto = true;
  43.             }
  44.  
  45.             if (ano.remainder(BI15).compareTo(BigInteger.ZERO) == 0) {
  46.                 System.out.println(HULUS);
  47.                 huluculu = true;
  48.             }
  49.  
  50.             if (bissexto && (ano.remainder(BI55).compareTo(BigInteger.ZERO) == 0)) {
  51.                 System.out.println(BULUS);
  52.                 bulukulu = true;
  53.             }
  54.  
  55.             if (!bissexto && !huluculu && !bulukulu) {
  56.                 System.out.println(ORDS);
  57.             }
  58.         }
  59.     }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement