Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Output Limit Exceed 谁帮忙看一下啊!

Posted by 19106118 at 2006-12-26 21:47:54 on Problem 2654
#include <stdio.h>
struct
{
    float w;
    float l;
}p[100];
int main()
{
    int a,b,i,p1,p2;
    char c1[9],c2[9];
    while(EOF!=scanf("%d",&a))
    {
        if(a==0)break;
        for(i=0;i<a;i++)p[i].w=p[i].l=0;
        scanf("%d",&b);
        for(i=0;i<b;i++)
        {
            scanf("%d%s%d%s",&p1,c1,&p2,c2);
            p1--;
            p2--;
            if(*c1=='r')
            {
                if(*c2=='p')
                {
                    p[p1].l++;
                    p[p2].w++;
                }
                else if(*c2=='s')
                {
                    p[p1].w++;
                    p[p2].l++;
                }
            }
            else if(*c1=='p')
            {
                if(*c2=='r')
                {
                    p[p1].w++;
                    p[p2].l++;
                }
                else if(*c2=='s')
                {
                    p[p1].l++;
                    p[p2].w++;
                }
            }
            else
            {
                if(*c2=='r')
                {
                    p[p1].l++;
                    p[p2].w++;
                }
                else if(*c2=='p')
                {
                    p[p1].w++;
                    p[p2].l++;
                }
            }
        }
        for(i=0;i<a;i++)
        {
            if(p[i].w+p[i].l==0)
            printf("-\n");
            else
            printf("%.3f\n",p[i].w/(p[i].w+p[i].l));
        }
        printf("\n");
    }
    return 0;
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator