Codeforces Gym 100637G G. #TheDress 暴力
G. #TheDress
Time Limit: 20 Sec
Memory Limit: 256 MB
题目连接
http://codeforces.com/gym/100637/problem/G
Description
After landing on planet i1c5l people noticed that blue and black clothes are quite popular among the locals. Each aboriginal has at least one blue-and-black piece of clothing in their wardrobe. This makes no interest except one curious detail: the locals claimed that these colors weren’t blue and black but white and gold.
Thus a simple test was created to differ a human being from an alien. On one of the wedding parties people took a picture of the blue-and-black groom mother’s dress. This picture was shown to some respondents who were asked the color of the dress. If the answer contained «blue» and «black» then there was no doubt that the respondent was from the Earth. The answer containing «white» and «gold» pointed to the person of planet i1c5l origin. If the answer contained neither of word pairs then it was clear that the respondent was a creature from another planet.
You have the complete survey log from planet i1c5l. Your task is to determine the constitution of the planet’s population based on the survey.
Input
The first line contains single integer N — the number of respondents (1 ≤ N ≤ 100). The following N lines contain the answers. No line is empty and no line is longer than 100 characters. The answer contains only lower-case Latin letters and spaces. It is guaranteed that no answer can contain «blue», «black», «white», and «gold» simultaneously.
Output
Output three numbers that describe the planet’s population, each on separate line.
The first number — percentage of earthlings in population.
The second number — percentage of aboriginals in population.
The third number — percentage of another planet creatures in population.
Output all numbers with 10 - 5 accuracy.
Sample Input
3
goldandwhite
white and pinkman
blueblueblue and a little bit black
Sample Output
33.3333333333
33.3333333333
33.3333333333
HINT
题意
问你回答中含有蓝黑的人,和含有白金的人,和普通人各占百分之多少
题解:
暴力找就好了……
代码
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
const int maxn=;
#define mod 1000000007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
//************************************************************************************** string s;
int find_blue()
{
int flag1=,flag2=;
int pos=s.find("blue");
int pos1=s.find("black");
if(pos!=s.npos)
flag1++;
if(pos1!=s.npos)
flag2++;
if(flag1==&&flag2==)
return ;
return ;
}
int find_gold()
{
int flag1=,flag2=;
int pos=s.find("white");
int pos1=s.find("gold");
if(pos!=s.npos)
flag1++;
if(pos1!=s.npos)
flag2++;
if(flag1==&&flag2==)
return ;
return ;
}
double ans1=,ans2=,ans3=;
int main()
{
int n=read();
for(int i=;i<n;i++)
{
getline(cin,s);
if(find_blue())
ans1+=;
else if(find_gold())
ans2+=;
else
ans3+=;
}
double sum=ans1+ans2+ans3;
printf("%.10f\n%.10f\n%.10f\n",ans1/sum*,ans2/sum*,ans3/sum*);
}
Codeforces Gym 100637G G. #TheDress 暴力的更多相关文章
- Codeforces Gym 100513G G. FacePalm Accounting 暴力
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100203G G - Good elements 暴力
G - Good elementsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- Codeforces Gym 100203G G - Good elements 标记暴力
G - Good elementsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- Codeforces gym 100685 A. Ariel 暴力
A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...
- Codeforces Gym 100513G G. FacePalm Accounting
G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...
- Codeforces Gym 100015H Hidden Code 暴力
Hidden Code 题目连接: http://codeforces.com/gym/100015/attachments Description It's time to put your hac ...
- Codeforces Gym 100203G Good elements 暴力乱搞
原题链接:http://codeforces.com/gym/100203/attachments/download/1702/statements.pdf 题解 考虑暴力的复杂度是O(n^3),所以 ...
- Codeforces Gym 101142 G Gangsters in Central City (lca+dfs序+树状数组+set)
题意: 树的根节点为水源,编号为 1 .给定编号为 2, 3, 4, …, n 的点的父节点.已知只有叶子节点都是房子. 有 q 个操作,每个操作可以是下列两者之一: + v ,表示编号为 v 的房子 ...
- Codeforces gym 101061 G【递推公式+逆元】
题意: 就是n复制m次,然后数mod1e9+7; 思路: 案例:31*10^6 + 31*10^4 + 31*10^2 + 31*10^0 所以就是一个等比数列,然后整理一下就是n*(10^(m*le ...
随机推荐
- Mac下配置PHP+Apache+phpMyAdmin+MySql远程链接
最近的项目是微信公众号平台的开发,微信官方给出的Demo是PHP的,发现大部分的学习资料也是PHP,那好吧,放弃Java,来段儿PHP吧 下面说说Mac下搭建PHP环境 数据库:MySQL-5.6.2 ...
- 常用的css的技巧
1.在做项目当中,由静态页面来载入到项目中,作为动态数据的部分,若是这个动态数据,前面或者后面有需要图片显示(图片是用background来显示的),一般不用float:left或者right,而是p ...
- android bin目录下的.ap_是神马文件?
resources.ap_ resources翻译过来是资源的意思 应该就是一种中间文件,可以改成rar.zip等压缩文件的类型,里面包含res.AndroidMainfest.xml.resourc ...
- Zend Framework 入门(4)—页面布局
Zend Framework 的页面布局模块——Zend_Layout——既可以跟 MVC 一起使用,也可以单独使用.本文只讨论与 MVC 一起使用的情况. 1. 布局脚本 在 application ...
- Pacman主题下给Hexo增加简历类型
原文 http://blog.zanlabs.com/2015/01/02/add-resume-type-to-hexo-under-pacman-theme/ 背景 虽然暂时不找工作,但是想着简历 ...
- 《Python CookBook2》 第一章 文本 - 每次处理一个字符 && 字符和字符值之间的转换
文本 - 总结: 什么是文本Python 中的string 类型是不可变类型.文本,一个字符的矩阵,每一个单独的文本快可以被缩进和组织起来. 基本的文本操作①解析数据并将数据放入程序内部的结构中:②将 ...
- 深入学习Android有关网络连接的内容
基于实际项目中碰到的些许问题,开始重新深入学习Android网络连接有关知识. Android的4.1.2版本的AndroidHttpClient模块setSoTimeout之后实际超时时间和设置的时 ...
- 通过gdb调试分析Linux内核的启动过程
作者:吴乐 山东师范大学 <Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 一.实验流程 1.打开环境 执 ...
- [iOS UI进阶 - 2.3] 彩票Demo v1.3
A.需求 真机调试 "关于”模块 存储开关状态 打电话.发短信 应用评分 打开其他应用 cell 在iOS6 和 iOS7的适配 block的循环引用 屏幕适配 code source: ...
- C#经典面试题 C# 中 Struct 与 Class 的区别,以及两者的适用场合
在一家公司面试时,第一个问题就是问到这个 转载 文章 http://www.cnblogs.com/waitrabbit/archive/2008/05/18/1202064.html 来解释此问题 ...