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 ...
随机推荐
- C# Stream篇(六) -- BufferedStream
BufferedStream 目录: 简单介绍一下BufferedStream 如何理解缓冲区? BufferedStream的优势 从BufferedStream 中学习装饰模式 如何理解装饰模式 ...
- JS location.href传参及接受参数
当前页面传参 window.location.href= + "&name="+"zhangchenxao"; 下个页面接受参数 var url = l ...
- vmware搭建linux环境
参考博文:https://www.cnblogs.com/wuzm/p/10877990.html
- CodeForces - 401C Team(简单构造)
题意:要求构造一个字符串,要求不能有连续的两个0在一起,也不能有连续的三个1在一起. 分析: 1.假设有4个0,最多能构造的长度为11011011011011,即10个1,因此若m > (n + ...
- Opencv调用深度学习模型
https://blog.csdn.net/lovelyaiq/article/details/79929393 https://blog.csdn.net/qq_29462849/article/d ...
- JS隔行换色和全选的实现
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- Session.Abandon与Session.Clear之间的区别
Session.Clear()就是把Session对象中的所有项目都删除了,Session对象里面什么都没有.但是Session对象还保留. Session.Abandon()就是把当前Session ...
- python可移植支持代码;用format.节省打印输出参数代码;math模块;
1.多平台移植代码: #!/usr/bin/env python3 这一行比较特殊,称为 shebang 行,在 Python 脚本中,你应该一直将它作为第一行. 请注意行中的第一个字符是井号(#). ...
- C++中的string详解
标准库类型string表示可变长的字符序列,为了在程序中使用string类型,我们必须包含头文件: #include <string> 声明一个字符串 声明一个字符串有很多种方式,具体如 ...
- Linux学习-第二章(命令)20200216