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

cin其中有很多小众的函数与其他重叠
不妨拿来用用(作死不止)


划重点!!!

1.cin.get(),相当于c里面的getchar(),可以往里面输入字符
2.cin.getline(),相当于string里面的getline(),不同的是可以控制输入的字符串长度

3.cout.put(),相当于putchar()

十分小众

根本没人用(好像我真的就是个蒟蒻啊)


好了,说了这么多,来波代码冷静冷静

#include <iostream>

using namespace std;

int main()
{
    char ufo[7]={0,0,0,0,0,0,0},group[7]={0,0,0,0,0,0,0};//蒟蒻,勿喷 
    int temp1=0,temp2=1,temp3=1;
    cin.getline(ufo,7),cin.getline(group,7);//真实小众函数
    for (;temp1<=6;temp1++)
    {
        if (ufo[temp1]!=0)
        {
            temp2=temp2*int(ufo[temp1]-64);//按照题目写的代码 
        }
        if (group[temp1]!=0)
        {
            temp3=temp3*int(group[temp1]-64);
        }
    }
    temp2=temp2%47,temp3=temp3%47;//蒟蒻套路
    if (temp2!=temp3)
    {
        cout<<"STAY";
    }
    else
    {
        cout<<"GO";
    }
    return 0;
}

猜你喜欢

转载自www.cnblogs.com/jelly123/p/10385859.html