水题一个,贴个代码吧。

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
#include <string>
#include <map>

using namespace std;
const int maxn=1005;
map<string,int> maps;
int main()
{
    int n,m,s;
    string str;
    scanf("%d %d %d",&m,&n,&s);
    int cnt=0;
    if(m<s){
        printf("Keep going...\n");
    }
    else{
        for(int i=0;i<s;i++)
            cin>>str;
        maps[str]=1;
        cout<<str<<endl;
        for(int i=s;i<m;i++){
            cin>>str;
            cnt++;
            if(cnt==n){
                if(!maps[str]){
                    maps[str]=1;
                    cnt=0;
                    cout<<str<<endl;
                }
                else
                    cnt--;
            }
        }

    }

    return 0;
}
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-18
  • 2021-09-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案