码迷,mamicode.com
首页 > 其他好文 > 详细

CF Gym 100637G \#TheDress

时间:2015-07-25 18:02:10      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:

题解:读懂题意按照题意模拟。。。

熟悉了一个库函数,strstr,memcpy

#include<cstdio>
#include<cstring>

int main()
{
    int N;
    char str[150];
    int cnt[3] = {0};
    scanf("%d",&N); getchar();
    for(int j = 0; j < N; j++){
        gets(str);
        if(strstr(str,"black")&&strstr(str,"blue")) cnt[0]++;
        else if(strstr(str,"white")&&strstr(str,"gold")) cnt[1]++;
        else cnt[2]++;
    }
    double sum = cnt[0] + cnt[1] + cnt[2];
    printf("%.10lf\n%.10lf\n%.10lf",cnt[0]/sum*100,cnt[1]/sum*100,cnt[2]/sum*100);
    return 0;
}

 

CF Gym 100637G \#TheDress

标签:

原文地址:http://www.cnblogs.com/jerryRey/p/4676128.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!