当前位置:网站首页>PTA tiantisai l1-078 teacher Ji's return (15 points) detailed explanation

PTA tiantisai l1-078 teacher Ji's return (15 points) detailed explanation

2022-07-06 04:07:00 Ceylan_

Mr. Ji, who once killed everyone in the TIANTI competition, decided to return to the TIANTI competition !

To simplify the topic , We might as well assume that each topic of the ladder race can use no more than 500 Of 、 A string containing only printable symbols is described , Such as :Problem A: Print "Hello world!".

as everyone knows , Mr. Ji's competition level is very excellent , You can think he can do every problem ( In fact, it is ……). therefore , Mr. Ji will look at the questions in order and do them . But Mr. Ji's level is too high , So he didn't bother to do the check-in question ( A waste of time ), say concretely , If there is... In the title string qiandao perhaps easy( Case sensitive ) Words , After reading the topic, Mr. Ji will skip the topic and don't do it .

Now, given how many questions there are in this ladder competition and how many questions Mr. Ji has finished , Please tell us which problem Mr. Ji is doing now , Or Mr. Ji has finished all the problems he intends to do .

remind : There are rules for score promotion in TIANTI competition , If you don't do the check-in question, the total score of the team may not be enough to upgrade , Ordinary contestants please don't learn from Mr. Ji's cool behavior !

Input format :

The first line of input is two positive integers N,M (1≤M≤N≤30), It means that this ladder race has N questions , Mr. Ji has finished now M Avenue .

Next N That's ok , Each line is a string that matches the Title Description , Represents the title content of the ladder race . Mr. Ji will look at the questions in the order given —— The first line is the first question Mr. Ji read , The second line is the second way , And so on .

Output format :

Output the question plane corresponding to the question Mr. Ji is currently working on in one line ( That is done M After a topic , Which question is Mr. Ji doing ). If Mr. Ji has finished all the problems he intends to do , Output one line Wo AK le.

sample input 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.

sample output 1:

L1-4 is qianDao.

sample input 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.

sample output 2:

Wo AK le

Detailed code :

#include<stdio.h>
#include<string.h>
int main()
{
    int x,y,r=0;
    scanf("%d %d",&x,&y);
    getchar();
    char a[x][1000];
    char b[x][1000];
    for(int i=0;i<x;i++)
        gets(a[i]);
    for(int i=0;i<x;i++)
    if(strstr(a[i],"easy")==NULL&&strstr(a[i],"qiandao")==NULL)
        strcpy(b[r++],a[i]);
    if(y>=r)
        printf("Wo AK le");
    else 
        printf("%s",b[y]);
    return 0;
}

原网站

版权声明
本文为[Ceylan_]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202132244368872.html

随机推荐