- class Program
- {
- static readonly int []daysOfMonths=new int[11]{31,28,31,30,31,30,31,31,30,31,30};
- static void Main(string[] args)
- {
- int year = Convert.ToInt32(Console.ReadLine());
- int month = Convert.ToInt32(Console.ReadLine());
- int numberOfDays = Convert.ToInt32(Console.ReadLine());
- for (int i = 0; i < month-1; i++)
- {
- numberOfDays += daysOfMonths[i];
- }
-
- if ((year % 4 == 0 && year % 100 != 0 || year % 400 == 0)&&month>2)
- {
- numberOfDays++;
- }
- Console.WriteLine(numberOfDays);
- }
- }
复制代码 这样应该是可以的, |