#4630: Can you help me please? I got it!


stanley17112000 (Stanley)

學校 : 國立交通大學
編號 : 13580
來源 : [66.253.158.102]
最後登入時間 :
2019-02-16 03:29:47
d586. 哈密瓜美語 -- jack1 | From: [112.104.111.139] | 發表日期 : 2010-12-04 15:55

#include <iostream>
using namespace std;
int main()
{
int number,b,c,total=0,p=10;
char first[]={0,'m','j','q','h','o','f','a','w','c','p','n','s','e','x','d','k','v','g','t','z','b','l','r','y','u','i'};
char second[]={0,'u','z','r','m','a','t','i','f','x','o','p','n','h','w','v','b','s','l','e','k','y','c','q','j','g','d'};
string h;
cin>>number;
for (int yo=0;yo<number;yo++)
{
cin>>c;
char a[c];
int b[c],j;
   cin>>h;
if (char (h[0])>='a'&& char (h[0])<='z')
{
for (int top=1;top<=26;top++)
for (int i=0;i<c;i++)
    if (char (h[i])==second[top])
  total=total+top;
  cout<<total;
  total=0;
}
else
{
j=0;
b[0]=0;
for (int k=1;k<c;k++)
cin>>b[k];
while (1)
{
if (h[j]>=48 && h[j]<=58)
j++;
else
break;
}
    if (j==2)
for (int y=0;y<j;y++)
  {
  b[0]=b[0]+(h[y]-48)*p;
p=1;
}
if (j==1)
b[0]=b[0]+(h[0]-48);
p=10;
for (int j=0;j<c;j++)
cout<<first[b[j]];
}
cout<<endl;
}
system ("pause");
return 0;
}
 
 
 
我試了都可以,但不給過去!! 可以幫幫我嗎? http://zerojudge.tw/ShowProblem?problemid=d586

 
ZeroJudge Forum