CF1472A Cards for Friends
本题解与Luogu同步
Solution
把长和宽分解,之后相乘看结果
可以定义一个函数实现分解,采用递推的形式
然后一个while
循环实现
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int t, cn = 1, w, h, n, cnt;
int qwq(int a) //分解函数
{
if(a % 2 == 0)
{
a /= 2;
cn *= 2;
qwq(a);
}
return cn;
}
int main()
{
scanf("%d", &t);
while(t--)
{
scanf("%d%d%d", &w, &h, &n);
cn = 1; //还原!!!
cnt = qwq(w); //计数
cn = 1; //还原!!!
cnt *= qwq(h); //计数
if(cnt >= n) printf("YES\n"); //若大于
else printf("NO\n");
}
return 0;
}
本文作者:W-RB,本文遵循 CC BY-NC 协议,转载请注明原文链接:https://www.cnblogs.com/w-rb/p/14254583.html和作者W-RB,且仅允许在非商业情况下使用