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

Re:为什么老是wa,求大牛

Posted by Doggy1006 at 2011-07-09 14:16:54 on Problem 1007
In Reply To:为什么老是wa,求大牛 Posted by:shoukaizhe at 2011-07-04 22:26:19
> #include<iostream>
> #include<string.h>
> 
> using namespace std;
> 
> int main()
> {
> 	int n,m=0;
> 	cin>>n>>m;
> 	char c[100][100];
> 	int *a = new int[m];
> 	
> 	
> 	
> 	for(int cou1 = 0; cou1<m; cou1++)
> 	{
> 		cin>>c[cou1];
> 		for(int cou2 =0; cou2<n; cou2++)
> 		{
> 			for(int j = 1; j <= n-cou2-1; j++)
> 			if(c[cou1][cou2] > c[cou1][cou2+j])a[cou1]++;
> 		}
> 	}                                                                                       
> 
> 	int t;
> 	char *temp = new char[n+1];
> 
> 	for(int k = 0; k < m; k ++)
> 	{
> 		for(int l = 0; l < m-k; l++)
> 		{
> 			if(a[l] > a[l+1])
> 			{
> 				t = a[l];
> 				a[l] = a[l+1];
> 				a[l+1] = t;
> 				strcpy(temp, c[l]);
> 				strcpy(c[l], c[l+1]);
> 				strcpy(c[l+1], temp);
> 			}
> 		}
> 	}																						
> 	cout<<endl;																									
> 	for(int k = 0; k < m; k ++)
> 		cout<<c[k]<<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