【Codeforces Round #639 (Div. 2) A】Puzzle Pieces
Codeforces div round
2023-09-14 09:03:41 时间
题目链接
翻译
给你一个拼图, 问你能不能把它拼成一个 \(n \times m\) 的方格图。
题解
会发现, 只有 \(2 \times 2\) 的能拼出来, 或者是一个长条形的。
往下或者往右一直延伸这样, 然后宽度或高度为1。
代码
#include<bits/stdc++.h>
#define ll long long
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%I64d",&x)
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
using namespace std;
const int N = 3e3;
const int MOD = 998244353;
int n,m;
int main(){
#ifdef LOCAL_DEFINE
freopen("D:\\rush.txt","r",stdin);
#endif
ios::sync_with_stdio(0),cin.tie(0);
int T;
cin >> T;
while (T--){
cin >> n >> m;
if (n == 1 || m == 1){
cout << "YES" << endl;
}else{
if (n == 2 && m == 2){
cout << "YES" << endl;
}else{
cout << "NO" << endl;
}
}
}
return 0;
}
相关文章
- 【Educational Codeforces Round 103 (Rated for Div. 2) C】Longest Simple Cycle
- 【Codeforces Round #695 (Div. 2) E】Distinctive Roots in a Tree
- 【Codeforces Round #693 (Div. 3) D】Even-Odd Game
- 【Codeforces Round #648 (Div. 2) D】Solve The Maze
- 【Codeforces 598D】Igor In the Museum
- 【Codeforces Round #476 (Div. 2) [Thanks, Telegram!] D】Single-use Stones
- 【Educational Codeforces Round 41 (Rated for Div. 2) D】Pair Of Lines
- 【Codeforces Round #462 (Div. 1) A】 A Twisty Movement
- 【Codeforces Round #456 (Div. 2) C】Perun, Ult!
- 【Codeforces Round #455 (Div. 2) C】 Python Indentation
- 【Codeforces Round #450 (Div. 2) B】Position in Fraction
- 【Codeforces Round #435 (Div. 2) A】Mahmoud and Ehab and the MEX
- 【Codeforces Round #431 (Div. 2) A】Odds and Ends
- 【Codeforces Round #425 (Div. 2) A】Sasha and Sticks
- 【Codeforces Round #424 (Div. 2) D】Office Keys
- 【Codeforces Round #422 (Div. 2) C】Hacker, pack your bags!(hash写法)
- 【Codeforces Round #422 (Div. 2) C】Hacker, pack your bags!(二分写法)
- 【Codeforces Round #422 (Div. 2) B】Crossword solving
- Codeforces Round #FF (Div. 1)-A,B,C
- Educational Codeforces Round 36 (Rated for Div. 2)
- Codecraft-18 and Codeforces Round #458 (Div. 1 + Div. 2, combined)
- Educational Codeforces Round 34 (Rated for Div. 2)
- Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2)
- Codeforces Round #427 (Div. 2)
- 树状数组 Playrix Codescapes Cup (Codeforces Round #413, rated, Div. 1 + Div. 2) C. Fountains
- 赛后题解:Codeforces Round #852 (Div. 2)1793C Dora and Search