下载的数据自己运行是对的,请问为什么提交之后WA了?

P1914 小书童——凯撒密码

Polaris_blig @ 2019-02-01 11:07:06

include<iostream>

include<iomanip>

include<math.h>

求各位大佬帮看,下载第一个输入:3 a输出:d ,自己测试是d,但就是通不过。求解

include<cstring>

include<string>

include<fstream>

include<sstream>

include<algorithm>

using namespace std; int main() { int n; char ch[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' }; string s; cin >> n; cin.ignore(); getline(cin, s); for (int i = 0;i < s.size();i++) { int num = s[i] - 'a' + n; cout << ch[num % 26]; } return 0; }


by Kuriyama_Mirai @ 2019-02-01 11:07:37

希望更丰富的展现?使用Markdown


by Polaris_blig @ 2019-02-01 11:09:37

上面的代码看不清,请看这个

include<iostream>

include<iomanip>

include<math.h>

include<cstring>

include<string>

include<fstream>

include<sstream>

include<algorithm>

using namespace std;

int main() {

int n;
char ch[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
string s;
cin >> n;
cin.ignore();
getline(cin, s);
for (int i = 0;i < s.size();i++) {
    int num = s[i] - 'a' + n;
    cout << ch[num % 26];
}

return 0;

}


by Doveqise @ 2019-02-01 11:13:29

希望更丰富的展现?使用Markdown


by juruojjl_ @ 2019-02-01 11:27:13

\color {gray}{\text{希望更丰富的展现?使用LaTeX}}

by Happynewyear @ 2019-02-08 11:18:54

希望更丰富的展现?使用Markdown


by hnyqwq @ 2019-02-08 11:19:45

希望更丰富的展现?使用Markdown


by hnyqwq @ 2019-02-08 11:20:47

#include<iostream>
#include<iomanip>
#include<math.h>
#include<cstring>
#include<string>
#include<fstream>
#include<sstream>
#include<algorithm>
using namespace std;

int main()
{
    int n;
    char ch[] = { 'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z' };
    string s;
    cin >> n;
    cin.ignore();
    getline(cin, s);
    for (int i = 0;i < s.size();i++)
    {
        int num = s[i] - 'a' + n;
        cout << ch[num % 26];
    }
    return 0;
}

by hnyqwq @ 2019-02-08 11:20:56

这样的对吧,,,


|