水题切不过啊
查看原帖
水题切不过啊
405146
Ruan_ji楼主2022/8/8 10:46

才50分,而且下载了数据,输出是对的,但是一交就错。望大佬指教~

#include <iostream>
#include <cstdio>
#include <map>
#include <cstring>

#define MAXN 105
#define rep(a, b) for (int i = a;i <= b; ++i)
#define rap(a, b) for (int j = a;j <= b; ++j)
#define mod 47

using namespace std;
map <char, int> Excel;
string str_comet;
string str_group;
long long val_comet = 1, val_group = 1;

int main () {
    getline (cin, str_comet);
    getline (cin, str_group);

    int number = 0;
    for (char i = 'A';i <= 'z'; ++i) {
        number += 1;
        Excel[i] = number;
    }
    
    for (int i = 0;i < str_comet.length(); ++i) {
        val_comet *= Excel[ str_comet[i] ];
        val_comet = val_comet % mod;
    }
    for (int i = 0;i < str_group.length(); ++i) {
        val_group *= Excel[ str_group[i] ];
        val_group = val_group % mod;
    }

    if (val_comet == val_group) cout << "GO";
    else cout << "STAY";
    return 0;
}
2022/8/8 10:46
加载中...