跳到正文

题解

题解:P15893 [TOPC 2025] Take It or Double It

CTLM_qwq_约 1 分钟
原文
文章信息与版本

文章信息

发布
2026年3月24日
收录
2026年4月1日
更新
2026年11月11日
篇幅
约 1 分钟
题目
P15893

版本

  1. v2当前
  2. v1

题目传送门

思路

当前为 xx 美元,那么选择 double it 后的钱chao’guo’le 会变为 2x2x。

  • 如果选择 double it 后的钱超过了 dd,即 2x>d2x > d,输出 take it。
  • 反之,输出 double it。

AC CODE

C++
#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;
}
原文