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 < ...
随机推荐
- jsencrypt加密
在登录时,前台页面的用户名.密码都是明文传输到后台的,漏洞扫描认为这样子不安全,就想到了前台js加密,后台解密的方法,要用到jsencrypt.js,具体代码如下: 前台页面: <!DOCTYP ...
- Spring Boot 的 Security 安全控制
Spring Security 是一个强大且高度可定制的身份验证和访问控制框架,完全基于 Spring 的应用程序的标准,Spring Security 为基于 Java EE 的企业应用程序提供了一 ...
- Flink 的广播变量
Flink 支持广播变量,就是将数据广播到具体的 taskmanager 上,数据存储在内存中,这样可以减缓大量的 shuffle 操作: 比如在数据 join 阶段,不可避免的就是大量的 shuff ...
- 水壶-[Kruskal重构树] [解题报告]
水壶 本来从不写针对某题的题解,但因为自己实在是太蠢了,这道题也神TM的恶心,于是就写篇博客纪念一下 H水壶 时间限制 : 50000 MS 空间限制 : 565536 KB 评测说明 : 2s,51 ...
- 如何用IDEA http://localhost:8080/不带上项目名访问
IDEA TOMCAT设置中把这里的项目名去掉即可
- 添加外键式异常 1215-cannot add foreign key constranint
添加外键时报错,原因是添加外键的表的字段的字段类型不一致 比如我的第一张表id是int类型,添加约束的dep_id是bigint类型,所以报错,只要把两张表添加约束的字段类型改成统一的即可 本人大学生 ...
- vue_resource和axios
vue_resource和axios 1. 简介 vue本身不支持发送AJAX请求,需要使用vue-resource.axios等插件实现 axios是一个基于Promise的HTTP请求客户端,用来 ...
- NodeHandles
os::NodeHandle类有两个作用: 第一.它在roscpp程序内提供了一种RAII(Resource Acquisition Is Initialization)类型式启动和关闭内部节点的方法 ...
- opencv——对象提取与测量
#include <opencv2/opencv.hpp> #include <iostream> #include <math.h> using namespac ...
- sparse linear regression with beta process priors
虽然翻译水平有限,但是看原文虽然看得懂,但是在词汇的问题上,会导致看了后面忘了前面,所以先蹩脚的翻译成中文,然后在仔细思考论文的思想(当然不能翻译成中文就不看英文原本了,得两者一起看,这样不会丢失前面 ...