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

C语言大虾请看为什么总是Runtime Error

Posted by ltj16cn at 2009-04-19 22:26:28 on Problem 3723 and last updated at 2009-04-19 22:29:45
#include <stdio.h>
int v[10000][2],k;

int nohave (x,y)
{
int n;
if (k!=0)
		for (n=0;n<k;n++)
			if (x==v[n][0]&&y==v[n][1])
				return n;
v[k][0]=x;
v[k][1]=y;
k++;
return 0;
}
int main()
{
	long mon[100];
	long money,mo;
	int x,y,i,j,m,n,r,p;
	scanf ("%d",&p);
	for (i=0;i<p;i++)
		{
			scanf("%c",&k);
			scanf("%d %d %d",&n,&m,&r);
			money=(n+m)*10000.0;
			for (j=0;j<r;j++)
			{
				scanf("%d %d %ld",&x,&y,&mo);
				if (!nohave(x,y))
					money-=mo;
			}
			mon[i]=money;
		}
for (i=0;i<p;i++)
printf("%ld\n",mon[i]);
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