当前位置:网站首页>码蹄集 - MT2095 · 曲径折跃
码蹄集 - MT2095 · 曲径折跃
2022-07-21 15:23:00 【Tisfy】
曲径折跃
时间限制:1秒
空间限制:128M
题目描述
小码哥特别狠,经常会把队友送到一些奇奇怪怪的地方去。这一次,他又将曲径折跃放在了jiejie的脚下。由于jiejie不想被打乱自己的节奏,所以他选择赶紧逃出升天。jiejie玩的是皇子,技能eq连招能位移x码的距离,eq位移是不消耗时间的。同时,jiejie的移动速度为n码每秒,曲径折跃的半径为r码。jiejie的技能可能在cd,e和q任意一个技能在cd都不能使用技能位移。曲径折跃生效时间为2秒。现在他想知道自己能不能逃出曲径折跃
输入描述
5个整数
e:e技能cd(为0时可使用)
q:q技能cd
x:移动距离
n:移速
r:半径
数据范围
e、q为非负整数,x、r、n为正整数
输出描述
如果能逃出输出yes
否则输出no
样例一
输入
0 0 500 100 700
输出
yes
这道题我读了很久(可能是因为没咋玩过LOL)
读懂题目后就很简单了
题目大意
问你 2 2 2秒内,能否移动 ≥ r \geq r ≥r的距离。
移动方式有两种:
- 步行:每秒可以移动 n n n米
- 瞬移:不消耗时间,可以瞬间移动 x x x米。但是前提是 e ≤ 2 且 q ≤ 2 e\leq 2且q\leq 2 e≤2且q≤2
题目分析
读懂了题目后,直接模拟即可。
两秒内,步行可以移动 2 × n 2\times n 2×n米,
如果 e ≤ 2 且 q ≤ 2 e\leq 2且q\leq 2 e≤2且q≤2 ,那么还可以再瞬移 x x x米。
看最终移动距离是否 ≥ r \geq r ≥r即可。
AC代码
/* * @Author: LetMeFly * @Date: 2022-07-21 10:29:45 * @LastEditors: LetMeFly * @LastEditTime: 2022-07-21 10:33:26 */
#include <bits/stdc++.h>
using namespace std;
#define mem(a) memset(a, 0, sizeof(a))
#define dbg(x) cout << #x << " = " << x << endl
#define fi(i, l, r) for (int i = l; i < r; i++)
#define cd(a) scanf("%d", &a)
typedef long long ll;
int main() {
int e, q, x, n, r;
cin >> e >> q >> x >> n >> r;
r -= 2 * n;
if (e <= 2 && q <= 2)
r -= x;
if (r <= 0)
puts("yes");
else
puts("no");
return 0;
}
虽然代码可以复制,但最好还是自己理解后再敲哦
原创不易,转载请附上原文链接哦~
Tisfy:https://letmefly.blog.csdn.net/article/details/125909920
边栏推荐
猜你喜欢
随机推荐
Educational Codeforces Round 100 (Rated for Div. 2) B. Find The Array 题解
Loadlibrary Failed with Error 87 | Open QTCreator Failed
关于性能测试的这点事,干货来袭「建议收藏」
贾跃亭的法拉第未来再获2.25亿美元融资,FF91即将量产!
Stack implementation of array structure
JMeter installation and setting (I)
软件-必备软件
Observer mode and publish / subscribe mode
Matlab GUI programming skills (XI): axes/geoaxes/polaraxes drawing to create GUI coordinate area
观察者模式与发布/订阅模式
ECCV 2022 | 修正FPN带来的大目标性能损害:You Should Look at All Objects
Awvs installation and problem solving
The meaning of sprintf (pointer + offset, "format", value) form
创建私有CA,我就用openSSL
Common commands for starting services
Indexes
NoSQL数据库之Redis【数据操作、持久化、Jedis、缓存处理】详解
Piecemeal knowledge - Business
Vscode - no PIP installer is available in the selected environment
Debian 全版本更换镜像源为阿里云镜像源