【牛客】2018年长沙理工大学第十三届程序设计竞赛

2018年长沙理工大学第十三届程序设计竞赛

A   LL

题意:判断输入的字符串是不是lovelive(无关大小写)

思路:水。注意输入方式,因为题里的一个输入有空格,所以用gets输入。

#include<bits/stdc++.h>
using namespace std;
int main()
{
    char a[107];
    while(gets(a))
    {
        for(int i=0; i<strlen(a); i++)
        {
            if(a[i]>=97) a[i]-=32;
        }
        if(strcmp(a,"LOVELIVE")==0)
        {
            cout<<"yes"<<endl;
        }
        else
            cout<<"no"<<endl;
    }
    return 0;
}

B   奇怪的加法

题意:不进位的正整数加法。

思路:由于数据小,所以不用大数加法。水。

#include<bits/stdc++.h>
using namespace std;
const int maxn=200002;//最大点数
const int maxm=200002;//最大边数
int main()
{
    int a,b,r,t;
    while(cin>>a>>b)
    {
        r=0;
        t=1;
        while(a||b)
        {
            r+=(a%10+b%10)%10*t;
            a/=10;
            b/=10;
            t*=10;
        }
        cout<<r<<endl;
    }
    return 0;
}

C  取手机

题意:略

思路:概率题。

原文地址:https://www.cnblogs.com/Kohinur/p/8834285.html