UVA-1636-Headshot
来源:互联网 发布:淘宝卖家中心下载 编辑:程序博客网 时间:2024/05/26 19:18
其实这道题不至于写题解,写个题解我只是为了说:这道题十分简单,直接AC就可以了。(有了D神般的成就感)
#include<stdio.h>#include<iostream>#include<math.h>#include<string.h>using namespace std;int main(){ char str[105]; while(cin>>str) { double p1,p2; //p1是不需要转的存活率,p2是需要转的 int huo = 0,si = 0,len = strlen(str); for(int i = 0;i < len - 1;i++) { if(str[i] == '0' && str[i + 1] == '1') si++; if(str[i] == '0' && str[i + 1] == '0') huo++; } if(str[len - 1] == '0' && str[0] == '1') si++; if(str[len - 1] == '0' && str[0] == '0') huo++; p1 = (double) huo * 1.0 / (huo + si); int huo2 = 0; for(int i = 0;i < len;i++) if(str[i] == '0') huo2++; p2 = (double) huo2*1.0/len; double p3 = p1 - p2;// printf("%lf %lf\n",p1,p2); if(p3 < 1e-6 && p3 > -1e-6) printf("EQUAL\n"); else if(p3 > 0) printf("SHOOT\n"); else printf("ROTATE\n"); } return 0;}
0 0
- UVA-1636-Headshot
- UVA 1636 Headshot 概率
- UVA 1636 - Headshot
- UVa 1636 Headshot
- UVa--1636 Headshot(概率)
- UVA 1636(p326)----Headshot
- uva 1636 Headshot
- UVa 1636 Headshot
- UVa 1636 Headshot
- UVa 1636 Headshot
- UVA 1636 Headshot
- UVa 1636 Headshot
- UVA.1636 Headshot (概率)
- UVa 1636 - Headshot(概率)
- UVa 1636 - Headshot(概率)
- uva 1636 Headshot 简单概率
- UVA 1636 Headshot(概率)
- Headshot UVA
- AutoResetEvent 允许线程通过发信号互相通信
- 测试
- LeetCode 078 Subsets
- 【最大子矩阵和】HDU1081-To The Max
- C++内存大会战
- UVA-1636-Headshot
- 等概率随机函数的实现
- 单例模式_java
- 《验证码识别》教程持续更新中_前2篇已更新完毕_可试看
- 使用spring @Scheduled注解执行定时任务
- 多线程下使用使用 UniDAC+MSSQL
- HDU 1698 Just a Hook(线段树成段更新求和)
- Tomcat漏洞利用
- 页面提交的内容中带有英文单引号,传到后台sql中,sql语句报错问题