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 ...
随机推荐
- TCP/IP详解学习笔记(3)-IP协议,ARP协议,RARP协议
把这三个协议放到一起学习是因为这三个协议处于同一层,ARP协议用来找到目标主机的Ethernet网卡Mac地址,IP则承载要发送的消息.数据链路层可以从ARP得到数据的传送信息,而从IP得到要传输的数 ...
- MySQL基础之第2章 Windows平台下安装与配置MySQL
2.1.msi安装包 2.1.1.安装 特别要注意的是,安装前要删除原来的my.ini和原来的data目录,改名也行,不然在最后一步会“apply security settings”报个1045错误 ...
- C#常用格式输出
ylbtech- .NET-Basic:C#常用格式输出 C#常用格式输出 1.A,相关概念返回顶部 using System; namespace Test { class Formating { ...
- HDU 1025-Constructing Roads In JGShining's Kingdom(最长不降子序列,线段树优化)
分析: 最长不降子序列,n很大o(n^2)肯定超,想到了小明序列那个题用线段树维护前面的最大值即可 该题也可用二分搜索来做. 注意问题输出时的坑,路复数后加s #include <map> ...
- 【STL】帮你复习STL泛型算法 一
STL泛型算法 #include <iostream> #include <vector> #include <algorithm> #include <it ...
- 关于【bootstrap】中,【tooltip】的不算bug的bug的个人看法
先说下遇到这个问题的背景吧. 就是在页面中有个div,这个div右上角(或者其他位置)有个 × 的图标(这个图标添加tooltip工具提示),光标移到这个图标时,触发tooltip,提示“点击移除”这 ...
- andriod的简单用法2
1.在Activity中使用menu //创建菜单项 public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this ...
- How to interact with the Chef Server using the Chef Server API using Shell script
!/usr/bin/env bash _chef_dir () { # Helper function: # Recursive function that searches for chef c ...
- linux 和 android 源码的 cross reference (即网页浏览代码的引用)
linux: http://lxr.free-electrons.com/ 相当好 android: http://androidxref.com
- 自动帮助创建android资源xml文件的网站
自动帮助创建android资源xml文件的网站 http://android-holo-colors.com/ stack overflow上一个seekbar的例子: http://stackove ...