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 ...
随机推荐
- selenium2Library报错: Unexpected error launching Internet Explorer. Browser zoom level was set to 119%. It should be set to 100%
Exception in thread "main" org.openqa.selenium.remote.SessionNotFoundException: Unexpected ...
- js对象等号赋值的bug
var a = {n: 1}; var b = a; a.x = a = {n: 2}; console.log(a.x); console.log(b.x); 有道题是这样的,觉得很奇葩,分析一下 ...
- caffe 官方demo python api
Jupyter https://nbviewer.jupyter.org/github/BVLC/caffe/blob/master/examples/net_surgery.ipynb 涉及: - ...
- 字符输出、if判断
1.这里学习交互性输入 #input 接受的所有数据都是字符串,即使你输入的是数字,但依然会被当成字符串来处理 #type 用来查看变量存入到内存时的属性 #int 将变量强制转化为整型 #str ...
- Java算法练习——盛最多水的容器
题目链接 题目描述 给定 n 个非负整数 a1,a2,...,an,每个数代表坐标中的一个点 (i, ai) .在坐标内画 n 条垂直线,垂直线 i 的两个端点分别为 (i, ai) 和 (i, 0) ...
- Frequently arduino function
unctions 功能if(Serial) ...
- JS元素的左右移动
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...
- 高质量Contrast Essay写作的结构分享
很多留学生对于Contrast Essay写作不是很了解,拿不到高分也是常有的事,那么大家要如何彻底掌握Contrast Essay写作呢?今天小编就给同学们分享Contrast Essay写作的结构 ...
- 《机实战》第2章 K近邻算法实战(KNN)
1.准备:使用Python导入数据 1.创建kNN.py文件,并在其中增加下面的代码: from numpy import * #导入科学计算包 import operator #运算符模块,k近邻算 ...
- quartz详解4:quartz线程管理
http://blog.itpub.NET/11627468/viewspace-1766967/ quartz启动后有多个线程同时在跑.启动时会启动主线程.集群线程.检漏线程.工作线程.主线程负责查 ...