LG9022

一道简单的签到题。

按照题意模拟即可。循环输入,对其进行分类讨论,最后输出即可。实现上有一些细节,具体见代码。

#include <iostream>
#include <cstdio>
using namespace std;
string s,t;
int a,b;
int main()
{
    while(true)
    {
        cin>>s;
        if(s=="99999") break;
        a=s[0]-'0';
        b=s[1]-'0';
        a+=b;
        if(a&1) t="left";
        else if(a>0) t="right";
        cout<<t<<' '<<s[2]<<s[3]<<s[4]<<endl;
    }
    return 0;
}
posted @ 2024-01-20 17:55  liyilang2021  阅读(2)  评论(0编辑  收藏  举报