PAT甲题题解-1124. Raffle for Weibo Followers-模拟,水题
水题一个,贴个代码吧。
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string.h>
#include <string>
#include <map> using namespace std;
const int maxn=;
map<string,int> maps;
int main()
{
int n,m,s;
string str;
scanf("%d %d %d",&m,&n,&s);
int cnt=;
if(m<s){
printf("Keep going...\n");
}
else{
for(int i=;i<s;i++)
cin>>str;
maps[str]=;
cout<<str<<endl;
for(int i=s;i<m;i++){
cin>>str;
cnt++;
if(cnt==n){
if(!maps[str]){
maps[str]=;
cnt=;
cout<<str<<endl;
}
else
cnt--;
}
} } return ;
}
PAT甲题题解-1124. Raffle for Weibo Followers-模拟,水题的更多相关文章
- PAT 1124 Raffle for Weibo Followers
1124 Raffle for Weibo Followers (20 分) John got a full mark on PAT. He was so happy that he decide ...
- 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 分)
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分)
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甲题题解-1012. The Best Rank (25)-排序水题
排序,水题因为最后如果一个学生最好的排名有一样的,输出的课程有个优先级A>C>M>E那么按这个优先级顺序进行排序每次排序前先求当前课程的排名然后再与目前最好的排名比较.更新 至于查询 ...
- PAT甲题题解-1019. General Palindromic Number (20)-又是水题一枚
n转化为b进制的格式,问你该格式是否为回文数字(即正着写和倒着写一样)输出Yes或者No并且输出该格式又是水题... #include <iostream> #include <cs ...
- PAT甲题题解-1062. Talent and Virtue (25)-排序水题
水题,分组排序即可. #include <iostream> #include <cstdio> #include <algorithm> #include < ...
随机推荐
- 9.Solr4.10.3数据导入(post.jar方式和curl方式)
转载请出自出处:http://www.cnblogs.com/hd3013779515/ 1.使用post.jar方式 java -Durl=http://192.168.137.168:8080/s ...
- 基于汇编的 C/C++ 协程 - 背景知识
近几年来,协程在 C/C++ 服务器中的解决方案开始涌现.本文主要阐述以汇编实现上下文切换的协程方案,并且说明其在异步开发模式中的应用. 本文地址:https://segmentfault.com/a ...
- C#实现之(自动更新)
做开发的人,尤其是做客户端(C/S)系统开发的人都会遇到一个头疼的问题,就是软件的自动更新:系统发布后怎样自动的更新程序,在下有幸开发过一个自动更新程序,更新程序与任何宿主程序是完全独立的:只要在主程 ...
- 利用单例模式设计数据库连接Model类
之前在<[php]利用php的构造函数与析构函数编写Mysql数据库查询类>(点击打开链接)写过的Mysql数据库查询类还不够完美,利用<[Java]单例模式>(点击打开链接) ...
- 编译有哪些阶段,动态链接和静态链接的区别 c++
预处理—->编译—->汇编—->链接 预处理:编译器将C程序的头文件编译进来,还有宏的替换 编译:这个阶段编译器主要做词法分析.语法分析.语义分析等,在检查无错误后后,把代码翻译成汇 ...
- git回答整理
1.git常用命令 首先明确:git有工作区.暂存区.版本库,工作区是电脑里能看到的目录 创建仓库: git init newrepo,使用我们指定目录作为Git仓库(初始化后,会在newrepo目录 ...
- Python2.7-datetime
datetime 模块用于操作日期时间模块内定义了5个类:date,time,datetime,timedelta,tzinfo 1.timedelta对象,代表一个时间间隔datetime.time ...
- SQL 字符串分割表函数
--字符串分割表函数 ) ) declare @i int; declare @count int; ); ); declare @Index int; )) declare @rowID int; ...
- golang channel 源码剖析
channel 在 golang 中是一个非常重要的特性,它为我们提供了一个并发模型.对比锁,通过 chan 在多个 goroutine 之间完成数据交互,可以让代码更简洁.更容易实现.更不容易出错. ...
- 使用MySQL命令行修改密码
格式:mysqladmin -u用户名 -p旧密码 password 新密码 1.给root加个密码ab12.首先在DOS下进入目录mysql\bin,然后键入以下命令 mysqladmin - ...