Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
int w, h, n;
while(t--){
cin>>w>>h>>n;
int steps = 0;
while(w%2 == 0 && w > 1){
steps++;
w /= 2;
}
while(h%2 == 0 && h > 1){
steps++;
h /= 2;
}
if(n <= pow(2, steps)){
cout<<"YES"<<endl;
continue;
}
cout<<"NO"<<endl;
}
return 0;
}
Copy The Code &
Try With Live Editor
Input
5
2 2 3
3 3 2
5 10 2
11 13 1
1 4 4
2 2 3
3 3 2
5 10 2
11 13 1
1 4 4
Output
YES
NO
YES
YES
YES
NO
YES
YES
YES
Demonstration
Codeforcess Solution 1472-A A. Cards for Friends ,C++, Java, Js and Python,1472-A,Codeforcess Solution