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 snailly18 at 2006-07-24 08:35:40 on Problem 2894
#include<stdio.h>
#include<stdlib.h>
typedef struct
{
	char c;
	int x;
	int y;
}Node;
main()
{
	int time;
	scanf("%d",&time);
	Node *p=NULL;
	int *result=NULL;
	while(time-->0)
	{
		int n=0;
		int i=0;
		int j=0;
		int max=0;
		int min=1000;
		Node *p=NULL;
	    int *result=NULL;
		scanf("%d",&n);
		p=(Node *)malloc(n*sizeof(Node));
		for(i=0;i<n;i++)
		{
			fflush(stdin);
			scanf("%c",&p[i].c);
			scanf("%d %d",&p[i].x,&p[i].y);
			if(max<p[i].y)
				max=p[i].y;
			if(min>p[i].x)
				min=p[i].x;
		}
		result=(int *)malloc((max-min)*sizeof(int));
		for(i=0;i<max-min;i++)
			result[i]=0;
		for(i=0;i<n;i++)
			for(j=p[i].x;j<p[i].y;j++)
				result[j-min]++;
		for(i=0;i<max-min;i++)
		{
			if(result[i]<1) continue;
			printf("%c",result[i]+'A'-1);
		}
		printf("\n");
		free(p);
		free(result);
	}
	return 1;
}
帮个忙,指点一下哪里错了吧,RE....

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