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 控制反转容器(Inversion of Control – IOC)
系列教程 Spring 框架介绍 Spring 框架模块 Spring开发环境搭建(Eclipse) 创建一个简单的Spring应用 Spring 控制反转容器(Inversion of Contro ...
- junit基础学习之-junit3和4的区别(4)
junit3和junit4的使用区别如下 1.在JUnit3中需要继承TestCase类,但在JUnit4中已经不需要继承TestCase 2.在JUnit3中需要覆盖TestCase中的setUp和 ...
- tornado反向解析
tornado反向解析 在路由中添加name属性,并且不能使用元组路由,应当由tornado.web.url定义路由. app = tornado.web.Application([ (r'/', I ...
- VS2012中MFC 操作mshflexgrid插入图片
CPictureHolder pic,picSection; pic.CreateFromBitmap(IDB_BITMAP); LPDISPATCH pPic = pic.GetPictureDis ...
- nginx报错
1. nginx报错 nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid&q ...
- Mount error(5):Input/output error on mount
https://superuser.com/questions/850301/mount-error5input-output-error-on-mount When setting up a sha ...
- 2020/2/6 PHP编程学习
今天把后台数据库处理好了,用了框架后真就是搬砖的一天..晚上继续刷题,明天把数据库处理完,这样一个商城框架就有了:
- Mybatis基本配置(一)
1. Mybatis介绍 MyBatis 是支持普通 SQL查询,存储过程和高级映射的优秀持久层框架.MyBatis 消除了几乎所有的JDBC代码和参数的手工设置以及结果集的检索.MyBatis 使用 ...
- 51nod 1346:递归
1346 递归 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 函数f(n,m) { 若n=1或m=1返回a[n][m]; 返回f(n-1,m)异或 ...
- 洛谷 P5661 公交换乘(队列)
题目传送门 解题思路: 暴力模拟. AC代码: #include<iostream> #include<cstdio> #include<queue> using ...