/**
* 编写程序实现输入指定的年月的月份有多少天
*
*/
package cn;
import java.util.Scanner;
public class SwitchTest2 {
public static void main(String[] args) {
System.out.println("请输入年月:");
Scanner sc = new Scanner(System.in);
int y = sc.nextInt();
int m = sc.nextInt();
int d = switch (m) {
case 1, 3, 5, 7, 8, 10, 12 -> 31;
case 4, 6, 9, 11 -> 30;
default -> y % 4 == 0 && y % 100 != 0 || y % 400 == 0 ? 29 : 28;
};
System.out.printf("%d年%d月里共有(%d)天",y,m,d);
}
}