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

mark

Posted by zjut020 at 2009-03-10 22:23:27 on Problem 1256
#include<iostream>
#include<fstream>
#include<string>
#include<algorithm>
using namespace std;
char mm[60];
int main()
{ //
  // ifstream cin("0.txt");
    int t;
    cin>>t;string s;int aa[14];
    for(int y='A';y<='Z';y++)
    mm[(y-'A')*2]=y;
    for(int y='a';y<='z';y++)
    mm[(y-'a')*2+1]=y;
    while(t--)
    {
        cin>>s;int n=s.length();
        for(int i=0;i<n;i++)
        {
            if(s[i]>='A'&&s[i]<='Z')
            aa[i]=2*(s[i]-'A');
            else aa[i]=2*(s[i]-'a')+1;        
        }
        sort(aa,aa+n);
        for(int i=0;i<n;i++)
        cout<<mm[aa[i]];cout<<endl;
        while(next_permutation(aa,aa+n))
        {for(int i=0;i<n;i++)
        cout<<mm[aa[i]];cout<<endl;}
    
    }
   // system("pause");
    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