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. Vue系列之 => 使用webpack-dev-server工具实现自动打包编译

    安装webpack-dev-server (webpack版本3.6.0,webpack-dev-server版本2.11.3)注意版本兼容问题,不然会有N多错误. npm i webpack-dev ...

  2. Python魔法方法详解

      魔法方法 含义   基本的魔法方法 __new__(cls[, ...]) 1.__new__是在一个对象实例化的时候所调用的第一个方法 2.它的第一个参数是这个类,其他的参数是用来直接传递给__ ...

  3. 制作Win10 U盘版移动便携系统

    制作U盘Win10 灌装WIM VHD_OneKey_beta2 把wim导入VHD文件 复制 WIN8USB.VHD boot bootmgr三个文件到U盘 把制作的Win10的VHD文件重命名为 ...

  4. Linq高级查询,分页查询及查询分页结合

    一.高级查询与分页查询 1.以...开头    StartsWith Repeater1.DataSource=con.Users.Where(r=>r.Nickname.StartsWith( ...

  5. echarts 图的点击事件(含:点击重复触发的问题及其解决方法)

    今天用echarts的时候发现一个问题 鼠标指向不同地市触发一个事件展示该地区趋势图  但是但是后台中不管我第几次鼠标指向都会触发两次指向事件 现在贴出解决办法: 问题完美解决.但是为什么会调用两次, ...

  6. java 字符串笔记

    java字符串当中有三个关于字符串对象的类. String 首先谈论下他们各自的含义: 1.String含义为引用数据类型,是字符串常量.是不可变的对象,(显然线程安全)在每次对string类型进行改 ...

  7. js中,转义字符的表示

    HTML中<,>,&等有特殊含义(<,>,用于链接签,&用于转义),不能直接使用.这些符号是不显示在我们最终看到的网页里的,那如果我们希望在网页中显示这些符号, ...

  8. 使用ReentrantLock同步,经典银行账户问题

    1.新建Account类,使用ReentrantLock同步增加和减少金额方法. package com.xkzhangsan.reentrantlockpack.bank; import java. ...

  9. Android组件系列----Intent详解(转载笔记)

    [正文] Intent组件虽然不是四大组件,但却是连接四大组件的桥梁,学习好这个知识,也非常的重要. 一.什么是Intent 1.Intent的概念: Android中提供了Intent机制来协助应用 ...

  10. PL/SQL数据类型

    在定义变量或常量时,必须要指定一个数据类型,PL/SQL是一种静态类型化的程序设计语言,静态类型化又称为强类型化,也就是说类型会在编译时而不是在运行时被检查,这样在编译时便能发现类型错误,以便增强程序 ...