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 ...
随机推荐
- 五、React事件方法(自写一个方法(函数),然后用按钮onClick触发它、自写方法改变this指向3种写法、
上接:https://www.cnblogs.com/chenxi188/p/11782349.html 项目目录: my-app/ README.md node_modules/ package.j ...
- Node.js 文件系统模块
章节 Node.js 介绍 Node.js 入门 Node.js 模块 Node.js HTTP模块 Node.js 文件系统模块 Node.js URL模块 Node.js NPM Node.js ...
- UVA - 1645 Count (统计有根树)(dp)
题意:输入n(n <=1000),统计有多少个n结点的有根树,使得每个深度中所有结点的子结点数相同.输出数目除以109+7的余数. 分析: 1.dp[i],i个结点的有根树个数 2.假设n=7, ...
- C# Socket编程入门
一直没有触及到这一块儿,学习下 在看一个小demo https://www.cnblogs.com/yy3b2007com/p/7476458.html
- 高次同余方程 $BSGS$
第一篇\(Blog\)... 还是决定把\(luogu\)上的那篇搬过来了. BSGS,又名北上广深 它可以用来求\(a^x \equiv b (mod \ n)\)这个同余方程的一个解,其中\(a, ...
- 关于Pytorch中autograd和backward的一些笔记
参考自<Pytorch autograd,backward详解>: 1 Tensor Pytorch中所有的计算其实都可以回归到Tensor上,所以有必要重新认识一下Tensor. 如果我 ...
- springboot-jar-web
预览 与springboot-jar的区别是: 1.pom.xml 将 <dependency> <groupId>org.springframework.boot</g ...
- GPU 、APU、CUDA、TPU、FPGA介绍
购买显卡主要关注:显存.带宽和浮点运算数量 GPU :图形处理器(英语:Graphics Processing Unit,缩写:GPU),又称显示核心.视觉处理器.显示芯片,是一种专门在个人电脑. ...
- 快速排序_python
def quicksort(ls,result): if len(ls)<=1: result+=ls # return result else: flag=ls[0] left=[x for ...
- POJ 3321 Apple Tree 树状数组 第一题
第一次做树状数组,这个东西还是蛮神奇的,通过一个简单的C数组就可以表示出整个序列的值,并且可以用logN的复杂度进行改值与求和. 这道题目我根本不知道怎么和树状数组扯上的关系,刚开始我想直接按图来遍历 ...