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

判的 output limit exceed,高手帮我看下,谢过。。。

Posted by tenseven17 at 2008-04-11 20:47:40 on Problem 1007
#include<iostream>
using namespace std;

int main()
    {
	int len, num;
	int i, j, k, temp, count[100], order[100];
	char s[100][50];
		
	cin >> len >> num;
		
	for( i = 0; i < num; i++ ){
	    order[i] = i;
	    cin >> s[i];
	    for( j = 0; j < len - 1; j++ )
	        for( k = j + 1; k < len; k++ )
		    if(s[i][j] > s[i][k])
	    count[i]++;
	}

	for( i = 0; i < num; i++ )
	    for( j = 0; j < num - i - 1; j++ )
		if( count[j] > count[j+1] ){
		    temp = order[j];
		    order[j] = order[j+1];
		    order[j+1] = temp;
		    temp = count[j];
		    count[j] = count[j+1];
		    count[j+1] = temp;
		}
		
	for( i = 0; i < num; i++ )
	    cout << s[order[i]] << 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