Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:判的 output limit exceed,高手帮我看下,谢过。。。In Reply To:判的 output limit exceed,高手帮我看下,谢过。。。 Posted by:tenseven17 at 2008-04-11 20:47:40 > #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; > } 数组要定义成s【100】【51】的 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator