View Code of Problem 8

import java.util.Scanner;
 
public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int t = scanner.nextInt();
		 scanner.nextLine();
		for(int i=0; i<t; i++) {
			String s = scanner.nextLine();
			char c = s.charAt(s.length()-1);
			int sum=365;
			if(c == '0') {
				sum -= 78;
			}else if(c == '2') {
				sum-= 79;
			}else if(c == '1' || c == '8' || c=='9') {
				sum -= 71;
			}else {
				sum -= 72;
			}
			System.out.println(sum);
		}
	}
}

Double click to view unformatted code.


Back to problem 8