水题一个,贴个代码吧。

#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;}elsecnt--;}}}return 0;
}

View Code

转载于:https://www.cnblogs.com/chenxiwenruo/p/6506425.html

PAT甲题题解-1124. Raffle for Weibo Followers-模拟,水题相关推荐

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

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

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

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

  4. PAT 1124 Raffle for Weibo Followers

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

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

  7. 寒假每日一题题解(1.29)摘花生(DP水题)

    摘花生 Hello Kitty想摘点花生送给她喜欢的米老鼠. 她来到一片有网格状道路的矩形花生地(如下图),从西北角进去,东南角出来. 地里每个道路的交叉点上都有种着一株花生苗,上面有若干颗花生,经过 ...

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

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

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

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

  10. 1124 Raffle for Weibo Followers(map)

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

最新文章

  1. C/C++各种数据类型转换汇总
  2. 玩Android的第一天
  3. LeetCode Sort Characters By Frequency
  4. 有一种努力叫:靠 自 己!
  5. 腾讯开源首个医疗AI项目,业内首个3D医疗影像大数据预训
  6. html5怎么改为vue_【面试需要Vue全家桶】一文带你看透Vue前端路由
  7. Android事件分发溯源详解
  8. 单例模式以及在C#中的使用
  9. Normal Data Structure Tricks
  10. 前端学习(2364):图片的上传
  11. mybatis学习(22):查询排序
  12. 通用模块 -- Dubbo 用户模块
  13. Java程序员晋升之路:“Java高级核心知识全面解析
  14. PLSQL无法连接64位Oracle数据库/Database下拉框为空的解决方法
  15. 做IT民工还是IT精英?
  16. 赏金猎人:德州堕胎法案 | 经济学人早报精选20210902
  17. 爬取东方财富股吧评论
  18. DEDE调用指定文章ID
  19. CISCO APIC-M2无法安装APIC软件故障解决
  20. scrcpy投屏教程、及无线投屏

热门文章

  1. [USB-Blaster] Error (209040): Can't access JTAG chain
  2. aws s3 连接建立
  3. ZooKeeper原生java客户端使用
  4. Oracle常用SQL总结
  5. ASP.NET生成日历
  6. LeetCode 127. Word Ladder
  7. 关于javascript中apply()和call()方法的区别
  8. spring定时任务详解
  9. 【底层原理】深入理解Cache (上)
  10. 技术人生:立志、勤学、改过、责善