PAT 1124 Raffle for Weibo Followers
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的更多相关文章
- 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 ...
- PAT甲级 1124. Raffle for Weibo Followers (20)
1124. Raffle for Weibo Followers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 1124 Raffle for Weibo Followers
题意:水题,直接贴代码了.(为什么我第一遍做的时候代码写的那么烦?) 代码: #include <iostream> #include <string> #include &l ...
- PAT1124:Raffle for Weibo Followers
1124. Raffle for Weibo Followers (20) 时间限制 400 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN ...
- PAT_A1124#Raffle for Weibo Followers
Source: PAT A1124 Raffle for Weibo Followers (20 分) Description: John got a full mark on PAT. He was ...
随机推荐
- 2017-2018-2 20155228 《网络对抗技术》 实验九:Web安全基础
2017-2018-2 20155228 <网络对抗技术> 实验九:Web安全基础 1. 实践内容 1.1 标理解常用网络攻击技术的基本原理 1.2 在Webgoat实验环境下实践相关实验 ...
- vm中的nat模式不能连接到主机,以及不能上网
主机能够ping通vm中的ip,但是vm不能ping通主机ip vm不能ping通主机:主要是虚拟机中的gateway的设置和vm的网络编辑器中的网关id不一致造成的 vm不能上外网:dns没有配置正 ...
- PAT (Basic Level) Practice (中文)1004 成绩排名 (20 分)
题目链接:https://pintia.cn/problem-sets/994805260223102976/problems/994805321640296448 #include <iost ...
- Eureka服务端源码流程梳理
一.简述 spring cloud三步走,一导包,二依赖,三配置为我们简化了太多东西,以至于很多东西知其然不知其所以然,了解底层实现之后对于一些问题我们也可以快速的定位问题所在. spring clo ...
- flutter -webview 报错 err_cleartext_not_permitted
文件 android\app\src\main\AndroidManifest.xml <manifest xmlns:android="http://schemas.android. ...
- VMware下liunx虚拟机仅主机模式上网
VMware上的配置 虚拟网络编辑器上的仅主机模式设置 可以自定义虚拟机的网段,我设置的是192.168.137.0 选择对应网卡的联网方式为仅主机模式 配置虚拟机网卡,主要是按虚拟网卡编辑器中设置的 ...
- tomcat启动项目时一直在跑,项目没起来
1. 在整合maven项目时我遇到一个问题,tomcat启动项目总是报超时,后来我把timeout调到180秒,还是启动超时.看了不是timeout时间短的问题. 2.弄了一天也没解决,后来请大神给看 ...
- LeetCode174-Dungeon Game-数组,动态规划
题目描述 The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dun ...
- java中Map.Entry的使用方法
在Map类设计是,提供了一个嵌套接口(static修饰的接口):Entry.Entry将键值对的对应关系封装成了对象,即键值对对象,这样我们在遍历Map集合时,就可以从每一个键值对(Entry)对象中 ...
- mongodb 数据自动备份
创建Mongodb数据库备份目录 mkdir -p ~/backup/mongod_bak/mongod_bak_now mkdir -p ~/backup/mongod_bak/mongod_bak ...