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

又是WA,需要帮忙找错啊,附代码

Posted by 771385494 at 2011-11-04 16:29:57 on Problem 1007 and last updated at 2011-11-04 16:32:41
#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
	char str[100][51];
	int n,m,i,j,k,total[100] = {0},count,max = 0;
	cin >> n >> m;
		cin.get();
		for(i = 0;i < m;i++)
			cin.getline(str[i],50,'\n');
		for(i = 0;i < m;i++){
			count = 0;
			for(j = 0;j < n - 1;j++)
				for(k = j + 1;k < n;k++)
					if(str[i][k] < str[i][j])
						count++;
			total[i] = count;
			if(count > max)
				max = count;
		}
		for(i = 0;i <= max;i++)
			for(j = 0;j < m;j++)
				if(total[j] == i)
					cout << str[j] << 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