23333333333333

详细题解

#include <cstdio>
using namespace std;
int main()
{
int k;
scanf("%d", &k);
while (k--)
{
int y, m, d;
scanf("%d %d %d", &y, &m, &d);
if (m == 9 && d == 30)
printf("YES\n");
else if (m == 1 && d == 30)
printf("YES\n");
else if ((m + d) % 2 == 0)
printf("YES\n");
else
printf("NO\n");
}
return 0;
}

2 条评论

  • @ 2016-02-25 19:14:38
    #include <stdio.h>
    
    #define MAXY 2006
    
    static bool b[110][13][32];
    int days[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    
    int setm(int y) {
        return 12 - (y == MAXY);
    }
    int setd(int y, int m) {
        if (y == MAXY && m == 11)
            return 4;
        days[1] =  (y % 400 == 0 || (y % 100 != 0 && y % 4 == 0)) + 28;
        return days[m];
    }
    
    int main() {
        int yy, y, m, d;
        int ny, nm, nd;
        
        for (yy = MAXY - 1900; yy >= 0; yy--) {
            y = yy + 1900;
            for (m = setm(y); m >= 1; m--)
                for (d = setd(y, m); d >= 1; d--) {
                    ny = y, nm = m, nd = d + 1;
                    if (nd > setd(y, m))
                        nd = 1, nm++;
                    if (nm > setm(y))
                        nm = 1, ny++;
                    if (ny <= MAXY && b[ny - 1900][nm][nd] == false) {
                        b[yy][m][d] = true;
                        continue;
                    }
                    ny = y, nm = m + 1, nd = d;
                    if (nm > setm(y))
                        nm = 1, ny++;
                    if (ny <= MAXY && b[ny - 1900][nm][nd] == false) {
                        b[yy][m][d] = true;
                        continue;
                    }
                    ny = y + 1, nm = m, nd = d;
                    if (ny <= MAXY && b[ny - 1900][nm][nd] == false) {
                        b[yy][m][d] = true;
                        continue;
                    }
                }
        }
        
        int n;
        
        scanf("%d", &n);
        for (int i = 0; i < n; i++) {
            scanf("%d %d %d", &y, &m, &d);
            puts((b[y - 1900][m][d]) ? "YES" : "NO");
        }
        
    }
    
  • @ 2014-08-21 00:31:18

    var y,m,d,n,i:integer;
    t:boolean;
    begin
    readln(n);
    for i:=1 to n do
    begin
    readln(y,m,d);t:=false;
    if (((m=9) or (m=11)) and (d=30)) or not(odd(m+d)) then t:=true;
    if i<>n then if t then writeln('YES') else writeln('NO')
    else if t then writeln('YES') else writeln('NO');
    end;
    end.

  • 1

信息

ID
1004
难度
5
分类
博弈论 点击显示
标签
(无)
递交数
5152
已通过
1801
通过率
35%
被复制
31
上传者