P1200 [USACO1.1]你的飞碟在这儿Your Ride Is He…

P1200 [USACO1.1]你的飞碟在这儿Your Ride Is He…

题目链接:https://www.luogu.org/problem/P1200

代码:

#include <bits/stdc++.h>
using namespace std;

int main()
{
    freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    char a[10],b[10];
    cin>>a>>b;
    int a1,b1,i,sum=1,tn=1;
    a1 = strlen(a);
    b1 = strlen(b);
    for(i=0;i<a1;i++){
        sum *= (a[i]-'A')+1;  //注意!!!
    }
    sum = sum%47;
    for(i=0;i<b1;i++){
        tn *= (b[i]-'A')+1;   //注意!!!
    }
    tn = tn%47;
    if(sum==tn){
        cout<<"GO"<<endl;
    }else{
        cout<<"STAY"<<endl;
    }
    return 0;
}
posted @ 2019-07-27 20:16  幽灵小一只  阅读(111)  评论(0编辑  收藏  举报