#8787: 請教哪裡出錯


CSE210608 (想像天然(C++))


#include<iostream>
using namespace std;
int main()
{
    long long int y,a,b;
    while(cin >> y){

    b=0;

    if (y%400==0 || y%100!=0 && y%4==0){
        cout << "This is leap year.\n" ;
        a=1;
        b=1;}

    if (y%15==0){
        cout << "This is huluculu festival year.\n" ;
        b=1;}

    if (y%55==0 && a==1){
        cout << "This is bulukulu festival year.\n" ;
        b=1;}

    else if (b!=1){
        cout << "This is an ordinary year.\n" ;}
}
    return 0;
}
 
Detailclose


WA (line:7)
輸出短少
您共輸出 6 行。
 

#12348: Re:請教哪裡出錯


s571991@gmail.com (cilegann chiu)


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


WA (line:7)
輸出短少
您共輸出 6 行。
 
 


這題是大數(超過long long範圍),不能用取餘運算子