返回列表 發帖
恨恨   我超討厭這題目
怒哪!!  真XX
  1. #include <iostream>
  2. #include <cstdlib>
  3. using namespace std;
  4. int main(void){
  5.    
  6.     int year,month,day;
  7.     while(cin>>year>>month>>day){
  8.                                  if(month==1&&day==1){
  9.                                                cout << "It is 1 day in "  <<year<< endl;
  10.                                                continue;
  11.                                                }        
  12.                                  
  13.                                  
  14.     int check ;
  15.     for(int a=1;a<=12;a++)
  16.     check = ( year % 4 == 0 && year % 100 != 0 || year % 400 == 0) ? 1 : 0 ;
  17.     int date = day ;
  18.    
  19.     switch ( month ) {
  20.          case 12: date += 30;
  21.          case 11: date += 31;
  22.          case 10: date += 29;
  23.          case 9: date += 31;
  24.          case 8: date += 31;
  25.          case 7: date += 30;
  26.          case 6: date += 31;
  27.          case 5: date += 30;
  28.          case 4: date += 31;
  29.          case 3: date += 29;
  30.          case 2: date += 31;         
  31.     }
  32.    
  33.     if( check == 1 && month >= 3 ) ++date ;
  34.          if(date<32){
  35.                      cout<<"Error"<<endl;
  36.                      break;
  37.     }else{
  38.     cout << "It is " << date << " days " << "in "  <<year<< endl;  
  39. }
  40. }

  41.     system("pause");
  42.     return 0;
  43. }
複製代碼
分數掛蛋的心情像空白的紙,再次期望著奇蹟的到來。

TOP

返回列表