美文网首页
2020-08-07 [USACO1.1]你的飞碟在这儿You

2020-08-07 [USACO1.1]你的飞碟在这儿You

作者: JalorOo | 来源:发表于2020-08-07 18:55 被阅读0次

    https://www.luogu.com.cn/problem/P1200

    #include <iostream>
    #include <cstdio>
    #include <cstring>
    #include <sstream>
    #include <algorithm>
    using namespace std;
    
    long long qmi(int m, int k)
    {
        int res = 1, t = m;
        while (k)
        {
            if (k&1) res = res * t;
            t = t * t;
            k >>= 1;
        }
        return res;
    }
    
    
    int read(){
        int x = 0,f = 1;
        char c = getchar();
        while (c<'0'||c>'9') {
            if (c=='-') {
                f = -1;
            }
            c = getchar();
        }
        while (c>='0'&&c<='9') {
            x = x*10+c-'0';
            c = getchar();
        }
        return x*f;
    }
    
    int main()
    {
        string ufo;
        string group;
        getline(cin, ufo);
        getline(cin, group);
        
        int ufo_sum = 1;
        int group_sum = 1;
        for (int i = 0; i<ufo.length(); i++) {
            ufo_sum *= (ufo[i] - 'A')+1;
        }
        for (int i = 0; i<group.length(); i++) {
            group_sum *= (group[i] - 'A')+1;
        }
        
        if(ufo_sum%47 == group_sum%47){
            cout<<"GO";
        }else{
            cout<<"STAY";
        }
        return 0;
    }
    /*
    5
    abc
    aaaa
    abc
    abcc
    12345
    ============
    4
    */
    

    相关文章

      网友评论

          本文标题:2020-08-07 [USACO1.1]你的飞碟在这儿You

          本文链接:https://www.haomeiwen.com/subject/qmrqdktx.html