Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Output Limit Exceed 谁帮忙看一下啊!#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator