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

为什么我的程序老是出现Runtime error?快疯了!!!求助ing

Posted by 584014434 at 2010-04-10 10:02:15 on Problem 1007
#include <iostream>
using namespace std;
#define INFY 10000
int main()
{
	int k,t,tep,m,n,flag,minnum,i,j,b[51];
	char a[51][101];
	cin>>m>>n;
	for(i=0;i<n;i++)
		for(j=0;j<m;j++)
			cin>>a[i][j];
	for(i=0;i<n;i++)
	{
		t=0;
		for(j=0;j<m;j++)
		{
            k=j-1;
			flag=1;
			while(flag)
			{
				k++;
				if(a[i][j]>a[i][k])
					t++;
				if(k==m-1)
					flag=0;
			}
		}
		b[i]=t;
	}
	for(j=0;j<n;j++)
	{
		tep=-1;
		minnum=INFY;
		for(i=0;i<n;i++)
		{
			if(minnum>b[i])
			{
				minnum=b[i];
				tep=i;
			}
		}
		for(i=0;i<m;i++)
			cout<<a[tep][i];
		cout<<endl;
		b[tep]=INFY;
	}
	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