#include <bits/stdc++.h> typedef long long ll; const int maxn = 100010; const int inf = 0x3f3f3f3f; using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int x, n, m; cin >> x >> n >> m; while (n && x>20) { n--; x = x / 2 + 10; } if (x <= m * 10) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }
#include <bits/stdc++.h> typedef long long ll; const int maxn = 200010; const int inf = 0x3f3f3f3f; using namespace std; vector<ll> G[maxn]; vector<ll> sum; int n, k; bool cmp(int a, int b) { return a > b; } int dfs(int u, int pre, int deep) { int ans = 1; for (int i = 0; i < G[u].size(); i++) { int v = G[u][i]; if (v == pre) continue; ans += dfs(v, u, deep + 1); } sum.push_back(deep - ans); return ans; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n >> k; for (int i = 0; i < n - 1; i++) { int u, v; cin >> u >> v; G[u].push_back(v); G[v].push_back(u); } dfs(1, 0, 1); sort(sum.begin(), sum.end(), cmp); ll cnt = 0; for (int i = 0; i < k; i++) cnt += 1ll * sum[i]; cout << cnt << endl; return 0; }