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

Re:请教 :为何出错? (题中所给数据测试正确) *有注释*

Posted by fluyy at 2013-03-09 19:17:21 on Problem 1761
In Reply To:请教 :为何出错? (题中所给数据测试正确) *有注释* Posted by:Alexandertk at 2008-08-21 00:38:09
> 
> 
> 
> #include<iostream>
> #include<iomanip>
> using namespace std;
> int main()
> {
> 	int m,i,j,k,mark;
> 	char c[100][10]={'\0'},ac[100][2]={'\0'},w;///////////c存放名字  	int n[100],nn[9][2];      /////////////////nn[][0]存放提交次数        nn[][1]存放ac次数             n存放时间
> 
> 	float sum[9];
> 	for(i=0;i<9;i++)
> 	{
> 		nn[i][0]=nn[i][1]=sum[i]=0;
> 	}
> 	cin>>m;
> 	for(i=0;i<m;i++)
> 		cin>>n[i]>>c[i]>>ac[i][0]>>ac[i][1];
> 	for(i=0;i<m;i++)                                    ///////////将已经ac的人再提交的数据 他的名字第一个字符赋为'\0'
> 	{
> 		if(c[i][0]=='\0')
> 			continue;
> 		if(ac[i][1]=='A')
> 		{
> 			for(j=i+1;j<m;j++)
> 			{
> 				if(ac[j][0]==ac[i][0])
> 				{ 
> 					mark=0;
> 					for(k=0;;k++)
> 					{
> 						if(c[j][k]=='\0')
> 							break;
> 						if(c[j][k]==c[i][k])
> 						{
>                             mark++;
> 						}
> 					}
> 					if(mark==k)
> 						c[j][0]='\0';
> 
> 				}
> 			}
> 		}
> 	}               ////////////将已经ac的人再提交的数据 他的名字第一个字符赋为'\0'              ** 到此结束
> 
> 	for(i=0;i<m;i++)
> 	{
> 			if(c[i][0]=='\0')
> 			   continue;
>             switch(ac[i][0])
> 			{
> 			case 'A':nn[0][0]++;if(ac[i][1]=='A'){nn[0][1]++;sum[0]+=n[i];}break;
>             case 'B':nn[1][0]++;if(ac[i][1]=='A'){nn[1][1]++;sum[1]+=n[i];}break;
> 			case 'C':nn[2][0]++;if(ac[i][1]=='A'){nn[2][1]++;sum[2]+=n[i];}break;
> 			case 'D':nn[3][0]++;if(ac[i][1]=='A'){nn[3][1]++;sum[3]+=n[i];}break;
> 			case 'E':nn[4][0]++;if(ac[i][1]=='A'){nn[4][1]++;sum[4]+=n[i];}break;
> 			case 'F':nn[5][0]++;if(ac[i][1]=='A'){nn[5][1]++;sum[5]+=n[i];}break;
> 			case 'G':nn[6][0]++;if(ac[i][1]=='A'){nn[6][1]++;sum[6]+=n[i];}break;
> 			case 'H':nn[7][0]++;if(ac[i][1]=='A'){nn[7][1]++;sum[7]+=n[i];}break;
> 			case 'I':nn[8][0]++;if(ac[i][1]=='A'){nn[8][1]++;sum[8]+=n[i];}break;
> 			}
> 	}
> 	for(i=0;i<9;i++)
> 	{
> 		w=i+65;
> 		cout<<w<<' '<<nn[i][1]<<' ';
> 		if(nn[i][1]!=0)
> 	    	cout<<setprecision(2)<<fixed<<(float)nn[i][0]/nn[i][1]<<' '<<sum[i]/nn[i][1];
> 		cout<<endl;
> 	}
>     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