uva-1636-概率

https://vjudge.net/problem/UVA-1636

 

   给出一个左轮手枪的弹夹串,第一枪是空的,问是继续打还是转一转再打下一枪还为空的概率大。继续打为空的概率就是 '00'的个数比上'00'+'01'的个数,也就是‘0’的个数。转一转为空的概率就是'0'的个数比上弹夹容量。

    

 1 #include<iostream>
 2 #include<cstring>
 3 #include<queue>
 4 #include<cstdio>
 5 #include<stack>
 6 #include<set>
 7 #include<map>
 8 #include<cmath>
 9 #include<ctime>
10 #include<time.h> 
11 #include<algorithm>
12 using namespace std;
13 #define mp make_pair
14 #define pb push_back
15 #define debug puts("debug")
16 #define LL long long 
17 #define pii pair<int,int>
18 #define eps 1e-12
19 char s[111];
20 int main()
21 {
22     LL n,m,i,j,k,t;
23     while(cin>>s){
24         int len=strlen(s);
25         int a=0,b=0;
26         s[len]=s[0];
27         for(i=0;i<len;++i){
28             if(s[i]=='0'){
29                 b++;
30                 if(s[i+1]=='0') a++;
31             }
32         }
33         if(a*len>b*b) puts("SHOOT");
34         else if(a*len<b*b) puts("ROTATE");
35         else puts("EQUAL");
36     }
37     return 0; 
38 }

 

转载于:https://www.cnblogs.com/zzqc/p/8973852.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值