文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>细节决定成败

细节决定成败

时间:2010-09-25  来源:追海逐风

such an easy problem that I didn't AC. WA 4 times.

Problem:

Judge if the (m, d) is a valid date, the year is 2010.

1. 2010 is not a leap year, so February has only 28 days.

2. Negative numbers must be considered.

#include <iostream>

using namespace std;

const int DAYS[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

int main() {
        int n;
        cin >> n;
        while (n--) {
                int m, d;
                cin >> m >> d;
                cout << ((m < 1 || m > 12 || d < 1 || d > DAYS[m]) ? "No" : "Maybe") << endl;
        }
}

相关阅读 更多 +
排行榜 更多 +
别惹神枪手安卓版

别惹神枪手安卓版

冒险解谜 下载
坦克战争世界

坦克战争世界

模拟经营 下载
丛林反击战

丛林反击战

飞行射击 下载