其他分享
首页 > 其他分享> > codeforces A. Yet Another Tetris Problem

codeforces A. Yet Another Tetris Problem

作者:互联网

在这里插入图片描述

题目

题意:

你又2X1的矩形,这个矩形只能竖放,不能平放,问最后能不能把题目给出的俄罗斯方块变成一个矩形。

思路:

因为只能竖放,所以我们只要看两个竖着的矩形之间差多少个,如果能被2整除,那么一定可以持平。

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
template <class T>
inline void read(T &ret) {
    char c;
    int sgn;
    if (c = getchar(), c == EOF) return ;
    while (c != '-' && (c < '0' || c > '9')) c = getchar();
    sgn = (c == '-') ? -1:1;
    ret = (c == '-') ? 0:(c - '0');
    while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
    ret *= sgn;
    return ;
}
inline void out(int x) {
    if (x > 9) out(x / 10);
    putchar(x % 10 + '0');
}
int main() {
    int t;
    read(t);
    while (t--) {
        int a, b;
        read(a), read(b);
        if (a % b == 0) printf("YES\n");
        else printf("NO\n");
    }
    return 0;
}

标签:矩形,int,codeforces,read,while,Tetris,Problem,include,getchar
来源: https://blog.csdn.net/weixin_45031646/article/details/104854765