View Code of Problem 8

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		for(int i = 0; i < N; i ++) {
			String s = sc.next();
			char charAt = s.charAt(s.length() - 1);
			int day = Integer.parseInt(charAt + "");
			if(day == 1 || day == 8 || day == 9) {
				System.out.println("294");
			} else if(day == 0) {
				System.out.println("287");
			} else if (day == 2){
				System.out.println("286");
			} else {
				System.out.println("293");
			}
			
			
		}
	}

}

Double click to view unformatted code.


Back to problem 8