为什么用map只能过掉一半的数据呀,求大佬们指点
查看原帖
为什么用map只能过掉一半的数据呀,求大佬们指点
921616
mammal7楼主2024/9/14 10:38
#include <bits/stdc++.h>
using namespace std;
map<char , int>q;
typedef long long LL;
int num;
string a , b;
int main()
{
    cin.tie(0);
    cout.tie(0);
    q['A'] = 1;
    num = q['A'];
    for(char i = 'A' ; i <= 'Z' ;)
        q[++ i] = ++ num;
    getline(cin , a);
    getline(cin , b);
    LL res1 = 1 , res2 = 1;
    for(int i = 0 ; i < a.size() ; i ++ )
        res1 *= q[a[i]];
    for(int i = 0 ; i < b.size() ; i ++ )
        res2 *= q[b[i]];  
    res1 %= 47 , res2 %= 47;
    if(res1 == res2)        cout << "GO";
    else                    cout << "STAY";
    return 0;
}
2024/9/14 10:38
加载中...