当前位置:网站首页>码蹄集 - 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
边栏推荐
- Container to container & container to host - interconnected via SSH protocol (multi node, cross host)
- 可视化之基础设置
- MODIS数据wget下载
- Observer mode and publish / subscribe mode
- Vlookup function
- Rewriting and overloading
- Matlab GUI programming skills (XI): axes/geoaxes/polaraxes drawing to create GUI coordinate area
- [in writing entity classes, why should int use integer type instead of int]
- 手机对比redmi note8与realme x2
- Vim Ctags
猜你喜欢
ECCV 2022 | fix the performance damage of large targets caused by FPN: you should look at all objects
EventLoop事件循环机制
用原生js实现放大镜功能
非参数检验
ArcGIS像元大小从0.00025变为米
自定义view之----自定义button
Matlab GUI programming skills (IX): explain the uitable function display table and related operations in detail (create table user interface)
NoSQL数据库之Redis【数据操作、持久化、Jedis、缓存处理】详解
Matlab GUI编程技巧(八):uitoolbar在图窗中创建工具栏
Matlab GUI编程技巧(九):详解 uitable 函数显示表格及相关操作(创建表用户界面)
随机推荐
空悬指针和孤儿内存
String说明
IO model, multiplexing
IO模型、多路复用
awvs安装及问题解决
Interface and abstract class
MySQL 将字符串转换为数字类型并进行排序
自定义view之----自定义button
Container to container & container to host - interconnected via SSH protocol (multi node, cross host)
缓存穿透、雪崩、一致性问题
FileNotFoundError: [Errno 2] No such file or directory: ‘cmake‘
Interview algorithm questions
零碎知识——统计相关
JMeter Association (II)
Custom class loader implementation
Splay completion plan
Sizeof judge array size
side effect of intrinsics
Assembler Instructions with C Expression Operands
实现逐行输出文本文件的内容