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

求救,各位帮忙看看我到底哪里错了。提供的数据都能够得到正确的啊!

Posted by duanxian0621 at 2010-11-01 20:33:01 on Problem 3425
#include<stdio.h>
#include<string.h>
#define maxn 1000005

int q[maxn],a[maxn],x[maxn],map[maxn];
int main()
{
	int n,i,p=0;
	while(scanf("%d",&n)!=EOF)
	{
		p++;	
		memset(map,0,sizeof(map));
		
		for(i=0;i<n;i++)
			scanf("%d%d%d",&q[i],&a[i],&x[i]);
		
		int sum=0,count=0;
		for(i=0;i<n;i++)
		{
			if(a[i])
			{
				map[q[i]]++;
				if(map[q[i]]>1)
					sum+=10;
				if(x[i])
					sum+=40;
				else
					sum+=20;
			}	
			
			else
				sum+=10;
		}
		printf("Sample Output %d\n",p);
		printf("%d\n",sum);
	}

	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