← Back to List

12778번: CTP공국으로 이민 가자 ↗

Solutions

C++14
564 B | 564 chars
#include <iostream>
using namespace std;
int T,K;
char s,c[550];
int n[550];
int main()
{
    cin>>T;
    for(int t=0; t<T; t++)
    {
        cin>>K>>s;
        if(s=='C')
        {
            for(int x=0; x<K; x++) cin>>c[x];
            for(int x=0; x<K; x++)
            {
                cout<<(int)(c[x]-'A'+1)<<" ";
            }
        }
        else
        {
            for(int x=0; x<K; x++) cin>>n[x];
            for(int x=0; x<K; x++)
            {
                cout<<(char)(n[x]+'A'-1)<<" ";
            }
        }
        cout<<endl;
    }
}