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:写了一个更短小精悍的代码

Posted by dreamvyps at 2010-12-12 20:01:21 on Problem 1256
In Reply To:写了一个更短小精悍的代码 Posted by:fuliang at 2009-05-05 00:25:44
> #include<iostream>
> #include<string>
> #include<cstring>
> #include<algorithm>
> using namespace std;
> 
> bool cmp(char c1,char c2){
> 	if(tolower(c1) == tolower(c2)) 
> 		return c1 < c2;
> 	else
> 		return tolower(c1) < tolower(c2);
> }
> 
> int main(){
> 	int n;
> 	cin >> n;
> 	int i;
>         string str;
> 	for(i = 0; i < n; i++){
> 		cin >> str;
> 		sort(str.begin(),str.end(),cmp);
> 		do{
> 			cout << str << endl;
> 		}while(next_permutation(str.begin(),str.end(),cmp));
> 	}
> 	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