#3685: 請問各位大大...


power811526 (PowerLi)

學校 : 國立臺中高級工業職業學校
編號 : 11507
來源 : [140.118.110.31]
最後登入時間 :
2018-11-12 19:13:25
d047. 10070 - Leap Year or Not Leap Year and ... -- UVa10070 | From: [123.240.166.149] | 發表日期 : 2010-04-28 20:45

#include <iostream>
using namespace std;
int main()
{
  long long int year;
  while(cin >> year)
  {
 
  if(year%4==0 && year%100!=0 || year%400==0)
  {
               cout << "This is leap year.\n";
               if(year%55==0)
               cout << "This is huluculu festival year.\n";
               if(year%15==0)
               cout << "This is huluculu festival year.\n";
               
               }
  else
  {
       int y=0;
       if(year%55==0){
       cout << "This is huluculu festival year.\n";
       y=1;}
       if(year%15==0){
               cout << "This is huluculu festival year.\n";
               y=1;}
       if(y==0)
       cout << "This is an ordinary year.\n";
       }
       cout << endl;
}

  return 0;
}

 

 

為啥會WA(line:7)

煩請各位大大指教...

 
#3686: Re:請問各位大大...


linishan (L)

學校 : 國立交通大學
編號 : 1090
來源 : [104.132.150.102]
最後登入時間 :
2019-05-10 19:57:54
d047. 10070 - Leap Year or Not Leap Year and ... -- UVa10070 | From: [125.228.219.40] | 發表日期 : 2010-04-28 20:54

#include
using namespace std;
int main()
{
  long long int year;
  while(cin >> year)
  {
 
  if(year%4==0 && year%100!=0 || year%400==0)
  {
               cout << "This is leap year.\n";
               if(year%55==0)
               cout << "This is huluculu festival year.\n";
               if(year%15==0)
               cout << "This is huluculu festival year.\n";
               
               }
  else
  {
       int y=0;
       if(year%55==0){
       cout << "This is huluculu festival year.\n";
       y=1;}
       if(year%15==0){
               cout << "This is huluculu festival year.\n";
               y=1;}
       if(y==0)
       cout << "This is an ordinary year.\n";
       }
       cout << endl;
}

  return 0;
}

 

 

為啥會WA(line:7)

煩請各位大大指教...

注意數字範圍

 這題是大數 

 
ZeroJudge Forum