Headshot

Time Limit: 1000ms
Memory Limit: 65536KB

This problem will be judged on PKU. Original ID: 3869
64-bit integer IO format: %lld      Java class name: Main

You have a revolver gun with a cylinder that has n chambers. Chambers are located in a circle on a cylinder. Each chamber can be empty or can contain a round. One chamber is aligned with the gun's barrel. When trigger of the gun is pulled, the gun's cylinder rotates, aligning the next chamber with the barrel, hammer strikes the round, making a shot by firing a bullet through the barrel. If the chamber is empty when the hammer strikes it, then there is no shot but just a "click". 
You have found a use for this gun. You are playing Russian Roulette with your friend. Your friend loads rounds into some chambers, randomly rotates the cylinder, aligning a random chamber with a gun's barrel, puts the gun to his head and pulls the trigger. You hear "click" and nothing else - the chamber was empty and the gun did not shoot. 
Now it is your turn to put the gun to your head and pull the trigger. You have a choice. You can either pull the trigger right away or you can randomly rotate the gun's cylinder and then pull the trigger. What should you choose to maximize the chances of your survival?

 

Input

The input file contains a single line with a string of n digits "0" and "1" (2 <= n <= 100). This line of digits represents the pattern of rounds that were loaded into the gun's chambers. "0" represent an empty chamber, "1" represent a loaded one. In this representation, when cylinder rotates before a shot, the next chamber to the right gets aligned with the barrel for a shot. Since the chambers are actually located on a circle, the first chamber in this string follows the last one. There is at least one "0" in this string.

 

Output

Write to the output file one of the following words (without quotes):

"SHOOT" - if pulling the trigger right away makes you less likely to be actually shot in the head with the bullet (more likely that the chamber will be empty). 
"ROTATE" - if randomly rotating the cylinder before pulling the trigger makes you less likely to be actually shot in the head with the bullet (more likely that the chamber will be empty). 
"EQUAL" - if both of the above choices are equal in terms of probability of being shot.

 

Sample Input

Sample Input #1:
0011 Sample Input #2:
0111 Sample Input #3:
000111

Sample Output

Sample Output #1:
EQUAL Sample Output #2:
ROTATE Sample Output #3:
SHOOT

Source

解题:英语阅读题。。。。条件概率什么的,意思就是当前是0了,那么后面是00的概率是多少,如果选择旋转,那么旋转得到0的概率又是多少,然后比较概率大小即可

 #include <cstdio>
#include <cstring>
using namespace std;
const int maxn = ;
char str[maxn];
int main() {
while(~scanf("%s",str)) {
int len = strlen(str),a = ,b = ,c = ;
for(int i = ; i < len; ++i)
if(str[i] == '') {
if(str[(i+)%len] == '') a++;
else if(str[(i+)%len] == '') b++;
} else c++;
if(len*a == (len - c)*(a + b)) puts("EQUAL");
else if(len*a < (len - c)*(a + b)) puts("ROTATE");
else puts("SHOOT");
}
return ;
}

POJ 3869 Headshot的更多相关文章

  1. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  2. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  3. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  4. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  5. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  6. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  7. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

  8. POJ 2752 Seek the Name, Seek the Fame [kmp]

    Seek the Name, Seek the Fame Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 17898   Ac ...

  9. poj 2352 Stars 数星星 详解

    题目: poj 2352 Stars 数星星 题意:已知n个星星的坐标.每个星星都有一个等级,数值等于坐标系内纵坐标和横坐标皆不大于它的星星的个数.星星的坐标按照纵坐标从小到大的顺序给出,纵坐标相同时 ...

随机推荐

  1. hiho 1590 - 紧张的会议室。区间问题

    题目链接 小Hi的公司最近员工增长迅速,同时大大小小的会议也越来越多:导致公司内的M间会议室非常紧张. 现在小Hi知道公司目前有N个会议,其中第i个会议的时间区间是(Si, Ei). 注意这里时间区间 ...

  2. 浅谈htmlentities 、htmlspecialchars、addslashes的使用方法

    html_entity_decode():把html实体转换为字符. $str = "just atest & 'learn to use '"; echo html_en ...

  3. UVA-10003 Cutting Sticks 动态规划 找分界点k的动规

    题目链接:https://cn.vjudge.net/problem/UVA-10003 题意 有根棍子,上面有些分割点(n<50),每次按分割点切割棍子时,费用为当前棍子的长度. 问有什么样的 ...

  4. HDU 6051 If the starlight never fade(原根+推式子)

    题目大意: 设\(f(i)\)为使\((x+y)^i \equiv x^i (mod\ p)\)成立的(x,y)的对数.其中\(1 \leq x \leq p-1 , 1\leq y\leq m\), ...

  5. jQuery第二课 点击弹出一个提示框

    选择器允许您对元素组或单个元素进行操作. jQuery 选择器 在前面的章节中,我们展示了一些有关如何选取 HTML 元素的实例. 关键点是学习 jQuery 选择器是如何准确地选取您希望应用效果的元 ...

  6. Union File System

    目录 Union File System AUFS Docker是如何使用AUFS的 image layer 和 AUFS (docker版本不同可能会有区别,我的是在/var/lib/docker下 ...

  7. ZOJ 3369 Saving Princess

    Saving Princess Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on ZJU. Origina ...

  8. Qt之pro配置详解

    简述 使用Qt的时候,我们经常会对pro进行一系列繁琐的配置,为方便大家理解.查找,现将常用的配置进行整理. 简述 配置 注释 CONFIG DEFINES DEPENDPATH DESTDIR FO ...

  9. Android OpenGL ES(七)----理解纹理与纹理过滤

    1.理解纹理 OpenGL中的纹理能够用来表示图像.照片,甚至由一个数学算法生成的分形数据.每一个二维的纹理都由很多小的纹理元素组成.它们是小块的数据,类似于我们前面讨论过的片段和像素.要使用纹理,最 ...

  10. HTML5 canvas炫酷棱镜效果的幻灯片特效

    这是一款效果很炫酷华丽的HTML5 canvas带棱镜效果的幻灯片特效. 这个特效在每个幻灯片的前面放置一个图形.并将图形制作为三棱镜效果.它底下的幻灯片图片会被"折射"到棱镜上面 ...