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 }

猜你喜欢

转载自www.cnblogs.com/zzqc/p/8973852.html