【Codeforces Round #693 (Div. 3) A】Cards for Friends

题目链接

链接

翻译

题解

看到除2就知道是个暴力题了。

模拟就行,log复杂度除不了几下的。

然后每次分成的碎片个数乘 \(2\) 也很快就会超过 \(n\) 了,为了防止爆 \(int\) 中间就停下来吧。

代码

#include <bits/stdc++.h>
#define lson l,mid,rt*2
#define rson mid+1,r,rt*2+1
#define LL long long
using namespace std;

const int N = 100;



int main(){
    ios::sync_with_stdio(0),cin.tie(0);
    int T;
    cin >> T;
    while (T--){
        LL w,h,n;
        cin >> w >> h >> n;
        LL cur = 1;
        while (w%2==0){
            w/=2;
            cur*=2;
            if (cur>=n) break;
        }
        while (h%2==0){
            h/=2;
            cur*=2;
            if (cur>=n) break;
        }
        if (cur >= n){
            cout <<"YES"<<endl;
        }else{
            cout <<"NO"<<endl;
        }
    }
    return 0;
}
posted @ 2021-01-06 10:46  AWCXV  阅读(103)  评论(0编辑  收藏  举报