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;
map<string,int>mp;
char str[1005][22];
int main()
{int m,n,s;scanf("%d%d%d",&m,&n,&s);if(s>m){printf("Keep going...\n");return 0;}for(int i = 1;i <= m;i ++)scanf("%s",str[i]);for(int i = s ;i<=m;i+=n){if(mp[ str[i] ] != 0){while(i<m){i++;if(mp[str[i]] == 0){mp[str[i]]=1;printf("%s\n",str[i]);break;}}   }else{printf("%s\n",str[i]);  mp[str[i]] = 1; } }return 0;
} 

1124 Raffle for Weibo Followers(20 分)相关推荐

  1. 【PAT (Advanced Level) Practice】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 ...

  2. PAT_A 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 ...

  3. PTA甲1124 Raffle for Weibo Followers (20 point(s))

    强烈推荐,刷PTA的朋友都认识一下柳神–PTA解法大佬 本文由参考于柳神博客写成 柳神的CSDN博客,这个可以搜索文章 柳神的个人博客,这个没有广告,但是不能搜索 还有就是非常非常有用的 算法笔记 全 ...

  4. PAT-1124. Raffle for Weibo Followers (20)

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

  5. 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 ...

  6. PAT 1124 Raffle for Weibo Followers python解法

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

  7. PAT甲级1124 Raffle for Weibo Followers :[C++题解]哈希表、微博转发抽奖

    文章目录 题目分析 题目来源 题目分析 来源:acwing 分析:开一个哈希表存已经中将的用户,避免重复发奖. 遍历所有m条姓名,从第一个中奖的开始,依次模拟即可. ac代码 #include< ...

  8. PAT 1124 Raffle for Weibo Followers

    PAT 1124 Raffle for Weibo Followers Java 1.题意 输入:数字m,n,s,一串人名. 第s个为获奖的人,则s+n 为下一个获奖的人,如果此人已经获奖,那么则往后 ...

  9. PAT(甲)1124 Raffle for Weibo Followers——未完成

    题目链接 按Ctrl单机链接,打开题目页面. 做题过程 题目分值 20 分 提交次数 分值 原因 解决方案 1 12 答案错误 重复n次 2 12 答案错误 未解决 收获:基本错题是通过样例猜题意,然 ...

  10. 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 ...

最新文章

  1. 移动端与PHP服务端接口通信流程设计(基础版)
  2. etl常用的三种工具介绍_Adobe Photoshop常用修图插件+屏幕模式+内容感知移动工具介绍...
  3. CentOS-创建yum本地源
  4. php 函数有命名空间吗_一篇弄懂PHP命名空间及use的使用
  5. 单模光纤和多模光纤的区别_多模光纤和单模光纤的区别与应用
  6. 3、PV、UIP、UV指的是什么
  7. oracle连接满报错日志,Oracle归档日志满了导致Oracle连接(ORA-00257)报错处理
  8. uninitialized_copy测试代码示例
  9. MySQL数据库----触发器
  10. codeforces 贪心+优先队列_算法基础04-深度优先搜索、广度优先搜索、二分查找、贪心算法...
  11. 单进程程序怎样在linux运行,linux下C程序:运行单个实例
  12. 到底绿茶能不能减肥瘦小肚子? - 生活至上,美容至尚!
  13. 移动平台前端开发总结(针对iphone,Android等手机)
  14. 北大青鸟java+web_java web ui开发
  15. 非旋Treap——维护数列
  16. hive select 语句
  17. a-btest 数据挖掘_挖掘新的垂直鼠标-帮助我的腕管
  18. Win系统使用WSL子系统Linux启动vGPU增强图形性能加速OpenGL
  19. 修改rpg maker mv的几种上限2020-05-25
  20. 基于TencentOS-tiny实现PM2.5传感器(攀藤PMSA003)数据解析思路及实现

热门文章

  1. 【转】ASP.NET AJAX入门系列(9):使用ScriptManager控件
  2. python multiprocess queue_Python:Multiprocessing Queue.put不适用于半大数...
  3. 流媒体技术笔记(DarwinStreamingServer相关)
  4. 修正 Mui 下拉上拉刷新功能
  5. 配置Android应用开发环境
  6. Unity加载模块深度解析(网格篇)
  7. ubuntu系统配置双网卡方法
  8. oracle查看所有表及字段
  9. Linux 与 Windows 计算文件夹大小
  10. Drools workbench kie-server部署和简单使用(全流程