Problem Type : Number Theory
import java.math.BigInteger;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Tarequzzaman Khan
*/
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger n, leap, lip2, lip3, hulu, bulu, p, q, r;
int cou=0, s1, s2, s3, s4, s5, m = 0;
leap = new BigInteger("4");
lip2 = new BigInteger("100");
lip3 = new BigInteger("400");
hulu = new BigInteger("15");
bulu = new BigInteger("55");
while (sc.hasNext()) {
if(cou!=0)
System.out.println();
// p= new BigInteger("0");
m = 0;
n = sc.nextBigInteger();
int res;
p = n.mod(leap);
s1 = p.intValue();
q = n.mod(lip2);
s2 = q.intValue();
r = n.mod(lip3);
s3 = r.intValue();
r = n.mod(hulu);
s4 = r.intValue();
r = n.mod(bulu);
s5 = r.intValue();
// System.out.println("" + s1 + " " + s2 + " " + s3 + " ");
if (s1 == m && s2 != m || s3 == m) {
if (s5 == m && s4 == m) {
System.out.println("This is leap year.\n" + "This is huluculu festival year.\n" + "This is bulukulu festival year.");
} else if (s5 == m) {
System.out.println("This is leap year.\n"+"This is bulukulu festival year.");
} else if (s4 == m) {
System.out.println("This is leap year.\n" + "This is huluculu festival year.");
} else {
System.out.println("This is leap year.");
}
} else {
if (s4 == m) {
System.out.println("This is huluculu festival year.");
}
else
{
System.out.println("This is an ordinary year.");
}
}
cou++;
}
}
}
import java.math.BigInteger;
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Tarequzzaman Khan
*/
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger n, leap, lip2, lip3, hulu, bulu, p, q, r;
int cou=0, s1, s2, s3, s4, s5, m = 0;
leap = new BigInteger("4");
lip2 = new BigInteger("100");
lip3 = new BigInteger("400");
hulu = new BigInteger("15");
bulu = new BigInteger("55");
while (sc.hasNext()) {
if(cou!=0)
System.out.println();
// p= new BigInteger("0");
m = 0;
n = sc.nextBigInteger();
int res;
p = n.mod(leap);
s1 = p.intValue();
q = n.mod(lip2);
s2 = q.intValue();
r = n.mod(lip3);
s3 = r.intValue();
r = n.mod(hulu);
s4 = r.intValue();
r = n.mod(bulu);
s5 = r.intValue();
// System.out.println("" + s1 + " " + s2 + " " + s3 + " ");
if (s1 == m && s2 != m || s3 == m) {
if (s5 == m && s4 == m) {
System.out.println("This is leap year.\n" + "This is huluculu festival year.\n" + "This is bulukulu festival year.");
} else if (s5 == m) {
System.out.println("This is leap year.\n"+"This is bulukulu festival year.");
} else if (s4 == m) {
System.out.println("This is leap year.\n" + "This is huluculu festival year.");
} else {
System.out.println("This is leap year.");
}
} else {
if (s4 == m) {
System.out.println("This is huluculu festival year.");
}
else
{
System.out.println("This is an ordinary year.");
}
}
cou++;
}
}
}
No comments:
Post a Comment