Time Limit:20 Sec
Memory limit:256 MB
Topic Connection
Http://codeforces.com/gym/100637/problem/G
Description
After landing in planet i1c5l people noticed that blue and black clothes is quite popular among the locals. Each aboriginal have at least one blue-and-black piece of clothing in their wardrobe. This makes no interest except one curious detail:the locals claimed the these colors weren ' t blue and black but white D Gold.
Thus A simple test is 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 is shown to some respondents who were asked the color of the dress. If The answer Contained«blue»and«black»then there is no doubt that the respondent is 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 is clear that the respondent is a creature from another planet.
You are 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 a single integer N -the number of respondents (1≤ N ≤100). The following N lines contain the answers. No line was empty and no line is longer than 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 5 accuracy.
Sample Input
3
Goldandwhite
White and Pinkman
Blueblueblue and a little bit black
Sample Output
33.3333333333
33.3333333333
33.3333333333
HINT
Test instructions
Ask the person with the blue-black in your answer, and the number of people with white gold, and the average percentage
Exercises
Violence to find just fine ...
Code
#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>typedefLong Longll;using namespacestd;//freopen ("d.in", "R", stdin);//freopen ("D.out", "w", stdout);#defineSspeed ios_base::sync_with_stdio (0); Cin.tie (0)#defineTest Freopen ("Test.txt", "R", stdin)Const intmaxn=202501;#defineMoD 1000000007#defineEPS 1e-9Const intinf=0x3f3f3f3f;Constll infll =0x3f3f3f3f3f3f3f3fll;inline ll Read () {ll x=0, f=1;CharCh=GetChar (); while(ch<'0'|| Ch>'9'){if(ch=='-') f=-1; ch=GetChar ();} while(ch>='0'&&ch<='9') {x=x*Ten+ch-'0'; ch=GetChar ();} returnx*F;}//**************************************************************************************strings;intFind_blue () {intflag1=0, flag2=0; intPos=s.find ("Blue"); intPos1=s.find ("Black"); if(pos!=s.npos) Flag1++; if(pos1!=s.npos) Flag2++; if(flag1==1&&flag2==1) return 1; return 0;}intFind_gold () {intflag1=0, flag2=0; intPos=s.find (" White"); intPos1=s.find ("Gold"); if(pos!=s.npos) Flag1++; if(pos1!=s.npos) Flag2++; if(flag1==1&&flag2==1) return 1; return 0;}Doubleans1=0, ans2=0, ans3=0;intMain () {intn=read (); for(intI=0; i<n;i++) {getline (cin,s); if(Find_blue ()) ans1+=1; Else if(Find_gold ()) Ans2+=1; ElseANS3+=1; } Doublesum=ans1+ans2+Ans3; printf ("%.10f\n%.10f\n%.10f\n", ans1/sum* -, ans2/sum* -, ans3/sum* -);}
Codeforces Gym 100637G G. #TheDress violence