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. 30种oracle常见的等待事件说明

    1Buffer busy waits从本质上讲,这个等待事件的产生仅说明了一个会话在等待一个Buffer(数据块),但是导致这个现象的原因却有很多种.常见的两种是: 当一个会话视图修改一个数据块,但这 ...

  2. T-SQL查询进阶-10分钟理解游标

    转:http://www.cnblogs.com/CareySon/archive/2011/11/01/2231381.html 概述 游标是邪恶的! 在关系数据库中,我们对于查询的思考是面向集合的 ...

  3. 底部菜单栏(二) TabHost & RadioGroup 实现

    需求:使用TabHost & RadioGroup实现底部菜单栏: 效果图: 实现分析: 1.目录结构: 代码实现: 1. activity_main.xml <?xml version ...

  4. linux下查看硬件配置的相关命令

    from:http://www.jakee.cn/index.php/archives/501.html 常用命令整理如下:查看主板的序列号: dmidecode | grep -i ’serial ...

  5. CMDB反思1

    由于,基本已经完成一期的功能开发,所以要继续CMDB的开发工作了. 最近看了不少CMDB相关的文章,也思考了不少,后面将所思所想(比较浅)记录一下. 发现很多内容都记录在Wiz上,抽空整理到博客中. ...

  6. csv文件与DataTable互相导入处理

    封装处理下,以后项目用到可以直接使用,比较简单. 1.首先看封装好的类 using System; using System.Data; using System.IO; using System.T ...

  7. webstorm下设置sass

    关于sass,就不想多说什么了.只要你有css基础,十分钟入门好吗.可以参考下资料:http://www.w3cplus.com/sassguide/ 今天想说的是webStorm下如何实现sass自 ...

  8. 数据库连接类oracleHelper

    //=============================================================================== // OracleHelper ba ...

  9. bzoj 2393 Cirno的完美算数教室(容斥原理+搜索)

    [题意] 定义C数为只包含数字2和9的数,求[L,R]内能被C数整除的个数. [思路] Dfs预处理出C数,并去除其中倍数的情况. Dfs搜索出现情况,奇数加,偶数减,当数值大于R时剪枝. [代码] ...

  10. 多校5 1001 HDU5781 ATM Mechine 记忆化搜索+概率

    // 多校5 1001 HDU5781 ATM Mechine // http://acm.hdu.edu.cn/search.php?field=problem&key=2016+Multi ...