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

1083 runtime error 始终过不去、求原因、、

Posted by pojwjk96 at 2011-04-17 18:09:01 on Problem 1083
#include <iostream>
using namespace std;
void ad(int *p,int m,int n)
{
	int t;
	if(m > n)
	{
		t = m;
		m = n;
		n = t;
	}
	while(m <= n)
	{
		p[m]++;
		m++;
	}
}
void zero(int * p)
{
	int i ;
	for( i = 0;i < 201;i++)
		p[i] = 0;
}
int main()
{
	int * a = new int[201]();
	int * b;
	int c;
	int d;
	int i,j,k,t = 0;
	int ii;
	zero(a);
	cin >> i;
	ii = i;
	b = new int [i];
	while(i--)
	{
		cin >> j;
		while(j--)
		{
			scanf("%d %d",&c,&d);
			ad(a,c,d);
		}
		for(k = 1;k < 201;k++)
		{
			if(t < a[k])
				t = a[k];
		}
		b[i] = t * 10;
		t = 0;
		zero(a);
	}
	while(ii--)
		cout << b[ii] << 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