码迷,mamicode.com
首页 > 其他好文 > 详细

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

时间:2019-02-15 21:14:47      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:重点   getch   题目   clu   cpp   ret   utc   main   code   

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;
}

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

标签:重点   getch   题目   clu   cpp   ret   utc   main   code   

原文地址:https://www.cnblogs.com/jelly123/p/10385859.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!