L1-6 吉老师的回归 (15 分)(C/C++)
  9zolsZ0v5GjU 2023年11月19日 63 0

L1-6 吉老师的回归 (15 分)(C/C++)_ci

输入样例1:

5 1
L1-1 is a qiandao problem.
L1-2 is so...easy.
L1-3 is Easy.
L1-4 is qianDao.
Wow, such L1-5, so easy.

输出样例1:

L1-4 is qianDao.

输入样例2:

5 4
L1-1 is a-qiandao problem.
L1-2 is so easy.
L1-3 is Easy.
L1-4 is qianDao.
Wow, such L1-5, so!!easy.

输出样例2:

Wo AK le

每遇到一个需要做的题目,就把m--, 如果m<0了,说明当前这道题是吉老师正在看的题,输出即可。 如果到最后也没有出现m<0的情况,说明吉老师已经做的题目≥一共需要做的题目,也就是AK了。

#include <iostream>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <cstring>
#include <sstream>
#include <stdlib.h>
#include <map>
#include <stack>
#include <queue>
#include <vector>
using namespace std;
typedef long long ll;
int main()
{
    int n,m;
    cin>>n>>m;
    string in;
    getchar();
    for (int i=0;i<n;i++){
        getline(cin,in);
        if (in.find("qiandao")!=in.npos||in.find("easy")!=in.npos){
            continue;
        }
        m--;
        if (m<0){
            cout<<in<<endl;
            return 0;
        }
    }
    cout<<"Wo AK le"<<endl;
    return 0;
}
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月19日 0

暂无评论

9zolsZ0v5GjU