#include <iostream>
#include <string>
using namespace std;
int main()
{
int t[]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26};
char a[200];
while(cin>>a)
{
if(a[0]=='0'&&strlen(a)==1)
cout<<""<<endl;
if(strlen(a)>1)
{
int b=0,i;
for(i=0;i<strlen(a);i++)
{
if(1<=t[(a[i]-65)]&&t[(a[i]-65)]<=26)
b=b+t[(a[i]-65)];
else
break;
}
if(i<=strlen(a)-1)
cout<<"Fail"<<endl;
else
cout<<b<<endl;
}
}
return 0;
}
難道有別種情況-65之後會介在1~26之間嗎??
正解答案好像一次是給Fail一次是給502...