测试点过了,为啥0分

回复帖子

@wuxinyuan123 2018-03-13 23:14 回复

include<iostream>

include<cstdlib>

include<cstdio>

include<cstring>

int d[1010]; char s1[110],s2[1010],s3[1010]; using namespace std; int main() { int i,j,n1,n2,k,m,s=0,a=0; // freopen("v.in","r",stdin); // freopen("v.out","w",stdout); scanf("%s",s1); scanf("%s",s2); n1=strlen(s1); n2=strlen(s2); for(i=0;i<n2;i++) s3[i]=s2[i]; for(i=0;i<n1;i++) { if(s1[i]>'Z')s1[i]=s1[i]-32;

}
    for(i=0;i<n2;i++)
{
    if(s2[i]>'Z')s2[i]=s2[i]-32;

}
for(i=0;i<n2;i++)
{

    d[++a]=s2[i]/*密文*/+1-s1[s++]/*密钥*/;

    if(s>=n1)
        s=0;
}
for(i=1;i<=n2;i++)
{
    if(d[i]>=26)d[i]=d[i]-26;
    if(d[i]<0)d[i]=d[i]+26;
}

for(i=1;i<=n2;i++)
{
    if(s3[i-1]>'Z') printf("%c",d[i]+64+32);
    else printf("%c",d[i]+64);
}

return 0;

}