ZJNU 2212 - Turn-based game
Mr.Lee每隔1/x s攻击一次,cpu每隔1/y s攻击一次
因为时间与答案无关,最后只看boss受到了多少次攻击
所以可以在每个人的频率上同时乘以xy
即Mr.Lee每隔y s攻击一次,cpu每隔x s攻击一次
这样看虽然时间延长但是结果不变
就可以二分查找出打败boss用时,最后再根据时间判断谁给予的最后一击
二分出用时t,则t%x==0表示cpu给予最后一击
t%y==0表示Mr.Lee给予最后一击
#include<stdio.h>
int main(){
long long n,x,y,k,l,r,m,d1,d2;
scanf("%lld%lld%lld",&n,&x,&y);
while(n--){
scanf("%lld",&k);
l=;
r=1e15;
while(l<r){
m=(l+r)>>;
if(m/x+m/y>=k)
r=m;
else
l=m+;
}
d1=r%x;
d2=r%y;
if(!d1&&!d2)
puts("Obviously Ruddy Eye is the first!");
else if(d1&&!d2)
puts("I like Ruddy Eye forever!");
else if(!d1&&d2)
puts("Spicy chicken computer!");
} return ;
}
ZJNU 2212 - Turn-based game的更多相关文章
- Bots(逆元,递推)
H. Bots time limit per test 1.5 seconds memory limit per test 256 megabytes input standard input out ...
- [转载]AngularJS and scope.$apply
http://jimhoskins.com/2012/12/17/angularjs-and-apply.html http://www.cnblogs.com/zhrj000/p/3383898.h ...
- Fast-paced Multiplayer
http://www.gabrielgambetta.com/fpm1.html —————————————————————————————————————————————————————— Fast ...
- Codeforces Bubble Cup 8 - Finals [Online Mirror]H. Bots 数学
H. Bots Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/575/problem/H Desc ...
- [转]ARM64 Function Calling Conventions
from apple In general, iOS adheres to the generic ABI specified by ARM for the ARM64 architecture. H ...
- Sphinx 2.2.11-release reference manual
1. Introduction 1.1. About 1.2. Sphinx features 1.3. Where to get Sphinx 1.4. License 1.5. Credits 1 ...
- Predict the Winner LT486
Given an array of scores that are non-negative integers. Player 1 picks one of the numbers from eith ...
- What is SCons?
SCons: A software construction tool What is SCons? SCons is an Open Source software construction too ...
- IEEEXtreme 10.0 - Game of Stones
这是 meelo 原创的 IEEEXtreme极限编程大赛题解 Xtreme 10.0 - Game of Stones 题目来源 第10届IEEE极限编程大赛 https://www.hackerr ...
随机推荐
- Spring 框架介绍
Spring 框架介绍 Spring 框架模块 Spring开发环境搭建(Eclipse) 创建一个简单的Spring应用 Spring 控制反转容器(Inversion of Control – I ...
- Web基础之Servlet
Servlet Servlet : server applet,直译服务小程序.那Servlet到底是什么呢? Servlet说白了其实就是一个接口,接口的作用是什么?规范呗,这个接口规定了下面三个问 ...
- 重新修改AD中PCB的形状快捷键
Altium Designer 快速修改板子形状为Keep-out layer大小 1,切换到 Keep-out layer层, 2,选择层,快捷键为S+Y: 3,设计-板子形状-按照选择 ...
- Day2-T1
原题目 Describe:贪心,左边和右边中选字典序小的 code: #include<bits/stdc++.h> using namespace std; int n,step,hea ...
- gdal库的学习和使用
1.windows下的编译 1.1.解压后打开nmake.opt,设置GDAL_HOME 1.2.进入vs的command promot,进入正常的那个即可,64位的没试过,可以参考gdal官网 1. ...
- 下页小希学MVC5+EF6.2 学习记录二
目的:1 学习mvc+ef 2 写下日记也是对自己的督促 从前端的UI开始 MVC分离的比较好,开发顺序没有特别要求,先开发哪一部分都可以,这次我们主要讲解前端UI的部分. ASP.NET MVC抛 ...
- foreach —(遍历数组或循环中的字符,以获取信息)
namespace ConsoleApplication2{ class Program {//letter 字母 gigit 数字 symbol 符号 static void Main(string ...
- 学术Essay写作关键:避免冗余
“冗余”(Redundant)意味着多余的.不必要的.在Essay写作中,redundant expression(即冗余表达)指的是在一个短语或一句句子中有一个单词完全重复了同一短语或句子中的另一个 ...
- 快速幂的类似问题(51Nod 1008 N的阶乘 mod P)
下面我们来看一个容易让人蒙圈的问题:N的阶乘 mod P. 51Nod 1008 N的阶乘 mod P 看到这个可能有的人会想起快速幂,快速幂是N的M次方 mod P,这里可能你就要说你不会做了,其实 ...
- centos 7.4 安装docker 19.03.6 版本。附带离线安装包
说明: 1.此环境为未安装过docker服务的环境, 如果已经安装,则自行卸载. 2.以下环境中上传的包及离线yum源默认为/home目录下,如无特殊说明,以此目录为准 步骤一:下载docker离线安 ...