Algorithm
Code Examples
#1 Code Example with C++ Programming
Code -
C++ Programming
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define debug(n) cout<<(n)<<endl;
const ll INF = 2e18 + 99;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
int n, x, m;
while(t--){
cin>>n>>x>>m;
while(n > 0 && m > 0){
if(n > 20 && x > 0){
n /= 2;
n += 10;
x--;
}
else{
n -= 10;
m--;
}
}
(n <= 0) ? cout<<"YES"<<endl : cout<<"NO"<<endl;
}
}
Copy The Code &
Try With Live Editor
Input
7
100 3 4
189 3 4
64 2 3
63 2 3
30 27 7
10 9 1
69117 21 2
100 3 4
189 3 4
64 2 3
63 2 3
30 27 7
10 9 1
69117 21 2
Output
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
Demonstration
Codeforcess solution 1337-B, B. Kana and Dragon Quest game, ,C++, Java, Js and Python, 1337-B