L1 - 6 吉老师的回归

发布时间 2023-04-21 11:31:42作者: 天黑星更亮

代码

#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
const int N = 100;
string s[N];
int main(){
    int n,m;
    cin >> n >> m;
    int cnt = 0;
    int flag = 0;
    getchar();//注意getchar()读取
    for(int i = 1; i <= n; i++){
       getline(cin, s[i]);
       string tp = s[i];
       int pos = tp.find("qiandao");//找不到int类型会返回-1
       if(pos == -1)
           pos = tp.find("easy");
      // cout << pos << endl;
       if(pos == -1) cnt++;
        
       if(cnt == m + 1 && flag == 0){
           cout << tp;
           flag = 1;
        }
   }
     if(!flag)
     printf("Wo AK le\n");
     return 0;
}