1124 Raffle for Weibo Followers (20 分)
 

John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers on Weibo -- that is, he would select winners from every N followers who forwarded his post, and give away gifts. Now you are supposed to help him generate the list of winners.

Input Specification:

Each input file contains one test case. For each case, the first line gives three positive integers M (≤ 1000), N and S, being the total number of forwards, the skip number of winners, and the index of the first winner (the indices start from 1). Then M lines follow, each gives the nickname (a nonempty string of no more than 20 characters, with no white space or return) of a follower who has forwarded John's post.

Note: it is possible that someone would forward more than once, but no one can win more than once. Hence if the current candidate of a winner has won before, we must skip him/her and consider the next one.

Output Specification:

For each case, print the list of winners in the same order as in the input, each nickname occupies a line. If there is no winner yet, print Keep going... instead.

Sample Input 1:

9 3 2
Imgonnawin!
PickMe
PickMeMeMeee
LookHere
Imgonnawin!
TryAgainAgain
TryAgainAgain
Imgonnawin!
TryAgainAgain

Sample Output 1:

PickMe
Imgonnawin!
TryAgainAgain

Sample Input 2:

2 3 5
Imgonnawin!
PickMe

Sample Output 2:

Keep going...
#include<bits/stdc++.h>
using namespace std;
typedef long long ll; int main(){
int m,n,s;
cin >> m >> n >> s;
vector<string> vec(m+);
for(int i=;i <= m;i++){
string t;cin >> t;
vec[i] = t;
}
if(s > m) {printf("Keep going...\n");return ;} map<string,int> mp;
for(int i=s;i <= m;){
if(mp[vec[i]] == ){
cout << vec[i] << endl;
mp[vec[i]] = ;
i += n;
}
else{
i++;
}
} return ;
}

发现一个性质,题面越长一般越简单。。

 

PAT 1124 Raffle for Weibo Followers的更多相关文章

  1. pat 1124 Raffle for Weibo Followers(20 分)

    1124 Raffle for Weibo Followers(20 分) John got a full mark on PAT. He was so happy that he decided t ...

  2. PAT甲级 1124. Raffle for Weibo Followers (20)

    1124. Raffle for Weibo Followers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...

  3. PAT甲级:1124 Raffle for Weibo Followers (20分)

    PAT甲级:1124 Raffle for Weibo Followers (20分) 题干 John got a full mark on PAT. He was so happy that he ...

  4. 1124 Raffle for Weibo Followers (20 分)

    1124 Raffle for Weibo Followers (20 分) John got a full mark on PAT. He was so happy that he decided ...

  5. 1124 Raffle for Weibo Followers[简单]

    1124 Raffle for Weibo Followers(20 分) John got a full mark on PAT. He was so happy that he decided t ...

  6. PAT A1124 Raffle for Weibo Followers (20 分)——数学题

    John got a full mark on PAT. He was so happy that he decided to hold a raffle(抽奖) for his followers ...

  7. 1124 Raffle for Weibo Followers

    题意:水题,直接贴代码了.(为什么我第一遍做的时候代码写的那么烦?) 代码: #include <iostream> #include <string> #include &l ...

  8. PAT1124:Raffle for Weibo Followers

    1124. Raffle for Weibo Followers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...

  9. PAT_A1124#Raffle for Weibo Followers

    Source: PAT A1124 Raffle for Weibo Followers (20 分) Description: John got a full mark on PAT. He was ...

随机推荐

  1. Spring restful

    1. RESTful 不是一项技术,也不是一个标准,而是一种风格,跟servlet不在一个层面上,根本无法比较.一个基于servlet的application也是可以是符合RESTful风格的,换言之 ...

  2. 【Access】数据库四门功课--[增删改查]基础篇

    一.增 以userinfo为例 1.增加一条完整的数据 INSERT INTO userinfo VALUES (1, 2, 3, 4); 基本格式:INSERT INTO AAA VALUES (X ...

  3. java个内部类的总结

    内部类的概念 成员内部类 访问成员内部类格式: 案例 局部内部类 案例 静态内部类 访问格式: 案例 匿名内部类 格式: 案例 内部类的概念 将类定义在类的内部,那么该类就成为内部类 注意: 内部类是 ...

  4. 如何在页面上同时使用 jQuery 和其他框架?

    Query 和其他 JavaScript 框架 正如您已经了解到的,jQuery 使用 $ 符号作为 jQuery 的简写. 如果其他 JavaScript 框架也使用 $ 符号作为简写怎么办? 其他 ...

  5. 第三方jar包上传私服和项目使用

    下面只做个人日志记录,勿喜勿喷 使用两个浏览器,带着下面的问题去看:https://www.cnblogs.com/tyhj-zxp/p/7605879.html.就会清晰了 1.下载和安装nexus ...

  6. Linux 下 ls -l 命令执行显示结果的每一列含义【转载】

    转自:zhuoya_的博客 原文地址>>https://blog.csdn.net/zhuoya_/article/details/77418413

  7. 立即执行函数(自执行函数) IIFE

    // 最常用的两种写法 (function(){ /* code */ }()); // 老道推荐写法 (function(){ /* code */ })(); // 当然这种也可以 // 括号和J ...

  8. GPIO8种方式小总结

    在输出3时写1时上反向为0,下为1,1时MOS不接通,0接通 为1时上导通输出高电平1: 为0时下导通输出低电平0: VDD为逻辑电源正 VSS为逻辑地 若为输出状态则施密特触发器总为开 然后经过上拉 ...

  9. Linux下复制文件

    命令: cp -Rf /文件名1/*               /文件名2 把文件夹1下的文件复制到文件2中(/* 表示复制文件夹1下的文件,不复制文件夹1)

  10. AutoCAD设置透明度后不起效果

    在AutoCAD中设置了实体的透明度,但是看到的效果是不透明 解决方法: 设置系统变量TRANSPARENCYDISPLAY