解题思路:
注意事项:
参考代码:
Scanner sc = new Scanner(System.in); String year = sc.next(); String month = sc.next(); int date = sc.nextInt(); int m = Integer.parseInt(month); int sum=0; int a[] = {0,31,28,31,30,31,30,31,31,30,31,30,31}; for (int i=1;i<m;i++){ sum+=a[i]; } sum+=date; int y = Integer.parseInt(year); if(m>1 && (y%4==0 && y%100!=0 || y%400==0)) { sum++; } System.out.println(sum);
0.0分
0 人评分