UVA 10785

#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
using namespace std;
const string kStr("AJAJAJAJAJASASASASASABABABABABAKAKAKAKAKATUTUTUTUTUCUCUCUCUCULULULULULUDUDUDUDUDUMUMEMEMEMEVEVEVEVEVENENENENENEWEWEWEWEWEFEFEFOFOFOXOXOXOXOXOGOGOGOGOGOPOPOPOPOPOYOYOYOYIYIHIHIHIHIHIQIQIQIQIQIZIZIZIZIZIRIRIRIRIR");

int main()
{
    int T;
    cin>>T;
    for(int case_num=1;case_num<=T;case_num++)
    {
        int n;
        cin>>n;

        string ans(kStr.substr(0,n));
        string odd,even;
        for(int i=0;i<n;i+=2)
            odd+=ans[i];
        for(int i=1;i<n;i+=2)
            even+=ans[i];
        sort(odd.begin(),odd.end());
        sort(even.begin(),even.end());

        cout<<"Case "<<case_num<<": ";
        for(int i=0;i<n;i++)
            if(i&1)
                cout<<even[i>>1];
            else
                cout<<odd[i>>1];
        cout<<endl;
    }

    return 0;
}

 

posted @ 2012-04-28 12:02  open your eyes  阅读(166)  评论(0编辑  收藏  举报