#29376: 為啥不行


milk_wu (milk(訂閱訂起來))


請位哪裡錯   

#include<iostream>

 

    using namespace std;

 

 

 

    int main(){

    int y, m, e, y2, m2, e2, s;

    cin >> y >> m >> e >> y2 >> m2 >>e2;

    s = y - y2;

    if (!(y % 400) || (!(y % 4) && (y % 100)))

    {

        if (s > 0)

    {

    cout << ((e - e2) + 365 * s) + 1 <<endl;

    }

    else

    {

        cout << (e - e2) + 1 <<endl;

    }

    }

    else

    {

        if (s > 0)

    {

    cout << ((e - e2) + 365 * s) <<endl;

    }

    else

    {

        cout << (e - e2) <<endl;

    }

    }

 

    return 0;

 

    }

#29378: Re:為啥不行


cges30901 (cges30901)


請位哪裡錯   

#include

 

    using namespace std;

 

 

 

    int main(){

    int y, m, e, y2, m2, e2, s;

    cin >> y >> m >> e >> y2 >> m2 >>e2;

    s = y - y2;

    if (!(y % 400) || (!(y % 4) && (y % 100)))

    {

        if (s > 0)

    {

    cout << ((e - e2) + 365 * s) + 1 <<endl;

    }

    else

    {

        cout << (e - e2) + 1 <<endl;

    }

    }

    else

    {

        if (s > 0)

    {

    cout << ((e - e2) + 365 * s) <<endl;

    }

    else

    {

        cout << (e - e2) <<endl;

    }

    }

 

    return 0;

 

    }


1. 多筆測資

2. 閏年的計算有問題

3. 兩個日期的順序似乎不一定