跳到正文

个人记录

C. 【三月份 -- 基础语法组】-- T3 --涂色 paint

zhangyuqiTAT约 2 分钟
原文
文章信息与版本

文章信息

发布
2025年4月12日
收录
2025年12月12日
更新
2026年11月21日
篇幅
约 2 分钟

版本

  1. v1当前

网址: https://cspjs.online/contest/660/problem/3

题解: https://b1bznc26af6.feishu.cn/file/TxyebfDa1orlxkxQ3DAcS2NYnuf?from=from_copylink

C++
#include <bits/stdc++.h>
using namespace std;
int a[10101][10101];
int main() {
    freopen("paint.in", "r", stdin);
    freopen("paint.out", "w", stdout);
    ios::sync_with_stdio(false);
    int n, m;
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i = 1; i <= n; i++) {
        a[i][1] = 1;
        for (int j = 2; j <= i; j++) {
            a[i][j] = (a[i - 1][j - 1] + a[i - 1][j]) % 2;
        }
    }
    for (int i = 1; i <= m; i++) {
        int b, c;
        cin >> b >> c;
        if (a[b][c] == 1)
            puts("Yes");
        else
            puts("No");
    }
    return 0;
}
原文