Codeforces Round #635 (Div. 2)---题解(AB)

Serena ·
更新时间:2024-09-20
· 526 次阅读

文章目录A. Ichihime and TriangleB. Kana and Dragon Quest game A. Ichihime and Triangle

题目
传送门

题意
从区间[a,b][b,c][c,d]中选取三个数,以此为三边构成三角形,输出这三个数

毕竟是A题,思路肯定比较简单,就找特殊的三角形嘛,等边肯定不行,然后发现等腰可以,即a,c,c

代码

#include using namespace std; typedef long long ll; int main() { ll a, b, c, d; int t; cin >> t; while (t--) { cin >> a >> b >> c >> d; cout << a << ' ' <<c<< ' ' << c << endl; } return 0; } B. Kana and Dragon Quest game

题目:
传送门

题意:
给定h,操作1、2上限n、m。
操作1:h⇒⌊h/2⌋+10
操作2:h⇒h−10

思路:
操作2能够减去的数字是固定的。对于操作1,当h⩾20时h始终下降,并且h越大减的越多。
先进行操作1,再操作2,判断最后是不是小于等于0。

代码:

#include using namespace std; int main() { int t; cin >> t; while (t--) { int x, n, m; cin >> x >> n >> m; while ((x / 2 + 10) < x && n) { x = x / 2 + 10; n--; } x -= m * 10; while ((x / 2 + 10) 0) cout << "NO\n"; else cout << "YES\n"; } return 0; }

码字不易,留个赞吧~


作者:xh_Dopamine



fo ce od ef for def iv

需要 登录 后方可回复, 如果你还没有账号请 注册新账号