标签:
-----------------------
水、
AC代码:
1 import java.util.Scanner; 2 3 public class Main { 4 5 public static void main(String[] args) { 6 7 Scanner sc=new Scanner(System.in); 8 int times=sc.nextInt(); 9 while(times-->0){ 10 int y=sc.nextInt(); 11 int m=sc.nextInt(); 12 int d=sc.nextInt(); 13 int ans=solve(y,m,d); 14 System.out.println(ans); 15 } 16 17 } 18 19 public static int days[]={0,31,0,31,30,31,30,31,31,30,31,30,31}; 20 21 public static boolean isLeafYear(int y){ 22 return (y%4==0&&y%100!=0) || (y%400==0); 23 } 24 25 public static int solve(int y,int m,int d){ 26 int res=0; 27 for(int i=1;i<m;i++) res+=days[i]; 28 if(m>=2) res+=isLeafYear(y)?29:28; 29 return res+d; 30 } 31 }
题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=75
标签:
原文地址:http://www.cnblogs.com/cc11001100/p/5891243.html