Coin Test n 204 郑州大学第四次ACM比赛试题

看懂题目中的要求很重要可怜可怜

#include<stdio.h>
#include<string.h>

int gcd(int a, int b)
{
    return b==0 ? a : gcd(b, a%b);
}

char s[65540];

int main()
{
    int N;
    scanf("%d", &N);
    scanf("%s", s);
    int i, length;
    length = strlen(s);
    int count=0;
    int Bingo=0;
    for(i=0;i<length;i++)
    {
        if(s[i] == 'U')
            count++;
        if(s[i] == 'S')
        {Bingo = 1; break; }
    }
    if(Bingo)
         printf("Bingo\n");
    else
    {
        int gnum;
        gnum = gcd(count, N);
        printf("%d/%d\n", count/gnum, N/gnum);
    }
    return 0;
}


 

posted on 2011-12-08 21:59  java课程设计例子  阅读(125)  评论(0编辑  收藏  举报