CE......
查看原帖
CE......
317584
mezWindows楼主2023/7/30 10:34

本地能过,但是说让我用fgets();在洛谷IDE也是CE

#include<algorithm>
#include<iostream>
#include<cstring>
#include<string>
#include<iomanip>
#include<cstdio>
#include<cctype>
#include<cmath>
#include<stack>
#include<queue>
using namespace std;
char password[100],word[100],cd[100];
int main(){
    ios::sync_with_stdio(false);
    gets(password);
    gets(word);
    int l1=strlen(password),l2=strlen(word);
    if(l1<l2){
        for(int i=l1;i<l2;i++){
            password[i]=password[i-l1];
        }
    }
    for(int i=0,c;i<l2;i++){
        if(password[i]>='A'&&password[i]<='Z'){
            c=password[i]-'A';
        }
        if(password[i]>='a'&&password[i]<='z'){
            c=password[i]-'a';
        }
        cd[i]=word[i]-c;
        if(word[i]>='A'&&word[i]<='Z'){
            if(cd[i]<'A'){
                cd[i]+=26;
            }
        }
        if(word[i]>='a'&&word[i]<='z'){
            if(cd[i]<'a'){
                cd[i]+=26;
            }
        }
    }
    for(int i=0;i<l2;i++){
        cout<<cd[i];
    }
    return 0;
}

2023/7/30 10:34
加载中...