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


power811526 (PowerLi)


#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)


#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)

煩請各位大大指教...

注意數字範圍

 這題是大數