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 暴力的更多相关文章

  1. Codeforces Gym 100513G G. FacePalm Accounting 暴力

    G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...

  2. Codeforces Gym 100203G G - Good elements 暴力

    G - Good elementsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  3. Codeforces Gym 100203G G - Good elements 标记暴力

    G - Good elementsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  4. Codeforces gym 100685 A. Ariel 暴力

    A. ArielTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/A Desc ...

  5. Codeforces Gym 100513G G. FacePalm Accounting

    G. FacePalm Accounting Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513 ...

  6. Codeforces Gym 100015H Hidden Code 暴力

    Hidden Code 题目连接: http://codeforces.com/gym/100015/attachments Description It's time to put your hac ...

  7. Codeforces Gym 100203G Good elements 暴力乱搞

    原题链接:http://codeforces.com/gym/100203/attachments/download/1702/statements.pdf 题解 考虑暴力的复杂度是O(n^3),所以 ...

  8. Codeforces Gym 101142 G Gangsters in Central City (lca+dfs序+树状数组+set)

    题意: 树的根节点为水源,编号为 1 .给定编号为 2, 3, 4, …, n 的点的父节点.已知只有叶子节点都是房子. 有 q 个操作,每个操作可以是下列两者之一: + v ,表示编号为 v 的房子 ...

  9. Codeforces gym 101061 G【递推公式+逆元】

    题意: 就是n复制m次,然后数mod1e9+7; 思路: 案例:31*10^6 + 31*10^4 + 31*10^2 + 31*10^0 所以就是一个等比数列,然后整理一下就是n*(10^(m*le ...

随机推荐

  1. HDU 5379 Mahjong tree

    题意:在一棵有n个节点的树上放编号从1到n的麻将,要求每个点的儿子节点之间的编号连续,每棵子树内的编号连续. 解法:手推一组样例之后就可以得到如下结论然后从根节点一边讨论一边搜就好了. 当一个节点只有 ...

  2. poj 1026(置换群)

    题意:给你一个变换规则,和一个字符串,问经过k次变换后得到的字符串. 思路:开始的时候试图去找它的整个周期,谁知道周期太大了,各种RE,后来在得知此题需要用置换群来优化,第一次接触置换群学习了下! 代 ...

  3. [Everyday Mathematics]20150106

    (1). 设 $f\in C[0,T]$, $g$ 是 $T$-周期函数, 试证: $$\bex \vlm{n}\int_0^T f(x)g(nx)\rd x=\frac{1}{T}\int_0^T ...

  4. C语言内存地址基础

    来源:http://blog.jobbole.com/44845/ 从计算机内存的角度思考C语言中的一切东东,是挺有帮助的.我们可以把计算机内存想象成一个字节数组,内存中每一个地址表示 1 字节.比方 ...

  5. lightoj 1022

    直接算即可,特别要注意精度 #include<cstdio> #include<cmath> int main(){ int t, CASE(0); double r; sca ...

  6. iOS 怎么样给自己的app打分呢?

    NSString *str =  [NSString stringWithFormat:@"itms-apps://itunes.apple.com/app/id%@",@&quo ...

  7. RTNETLINK answers: File exists错误

    解决ssh连接虚拟机出错,RTNETLINK answers: File exists 解决步骤如下: 使用ssh连接虚拟机的时候,发现目标主机无法连接,登录虚拟机,查看ssh监听是否开启: 发现监听 ...

  8. HDU4553 约会安排

    http://www.mamicode.com/info-detail-422707.html 线段树区间覆盖,开两个线段树,一个记录DS,一个NS // #pragma comment(linker ...

  9. 直接调用系统Camera

    关键思路: 初始化 组件: 创建并启动拍照intent: 使用回调函数onActivityResult()处理图像. 关键代码: 初始化 组件: takePicBtn = (Button) findV ...

  10. jsViews validates(验证)

          概述:jsViews使得前端开发过程将js代码与html分离,通过模板实现数据与html元素关联,通过绑定方法用数据填充模板,达到渲染html要素的目的.采用该方法后js文件中再也不会出现 ...