题解:P15893 [TOPC 2025] Take It or Double It
题目传送门
思路
当前为 double it 后的钱chao'guo'le 会变为
- 如果选择
double it后的钱超过了d ,即2x > d ,输出take it。 - 反之,输出
double it。AC CODE
#include <bits/stdc++.h> using namespace std; int main() { int x, d; cin >> x >> d; if (x * 2 <= d) { cout << "double it"; } else { cout << "take it"; } return 0; }