hdoj2005

 #include<iostream>
//#include<cmath>
using namespace std;
int lev(int n)
{
   if((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0))
   {
         return 1;
         } 
         else return 0;
    }
 
     
int main()
{
    int month[2][13]=
    {{0,31,28,31,30,31,30,31,31,30,31,30,31},
    {0,31,29,31,30,31,30,31,31,30,31,30,31}};
    int s,y,m,d;
    while( cin >> y >> m >> d )
    {
          s = 0;
          for( int i = 1;i < m ;i ++)
          {
               s += month[lev(y)][i];
               
               }
                s += d;
               cout << s << endl;
           }
    system("pause");
    }


你可能感兴趣的:(OJ)