PAT(甲)1124 Raffle for Weibo Followers——未完成
题目链接
做题过程
题目分值
20
分
提交次数 | 分值 | 原因 | 解决方案 |
---|---|---|---|
1 | 12 | 答案错误 | 重复n次 |
2 | 12 | 答案错误 | 未解决 |
收获:基本错题是通过样例猜题意,然后再去扣条件。
只有12分的代码如下
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>using namespace std;int main()
{vector <string> fins, win;int n, m, k, flag;char str[25];int num = 0;scanf("%d %d %d", &n, &m, &k);vector<string>::iterator it, its;while(n--){scanf("%s", str);its = find(fins.begin(), fins.end(), str);if(its == fins.end())num ++;fins.push_back(str);}flag = 0;for(it = fins.begin(); it != fins.end(); ++it ){flag++;if(flag == k){its = find(win.begin(), win.end(), *it);if(its != win.end()){flag--;}else{win.push_back(*it);flag = -1;m--;if(m==0)break;}}}for(it = win.begin(); it != win.end(); ++it){cout << *it << endl;}if(m!=0)printf("Keep going...\n");return 0;
}
PAT(甲)1124 Raffle for Weibo Followers——未完成相关推荐
- PAT甲级1124 Raffle for Weibo Followers :[C++题解]哈希表、微博转发抽奖
文章目录 题目分析 题目来源 题目分析 来源:acwing 分析:开一个哈希表存已经中将的用户,避免重复发奖. 遍历所有m条姓名,从第一个中奖的开始,依次模拟即可. ac代码 #include< ...
- PTA甲1124 Raffle for Weibo Followers (20 point(s))
强烈推荐,刷PTA的朋友都认识一下柳神–PTA解法大佬 本文由参考于柳神博客写成 柳神的CSDN博客,这个可以搜索文章 柳神的个人博客,这个没有广告,但是不能搜索 还有就是非常非常有用的 算法笔记 全 ...
- 【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 ...
- 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 ...
- PAT 1124 Raffle for Weibo Followers
PAT 1124 Raffle for Weibo Followers Java 1.题意 输入:数字m,n,s,一串人名. 第s个为获奖的人,则s+n 为下一个获奖的人,如果此人已经获奖,那么则往后 ...
- 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_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 ...
- 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 ...
- 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 ...
最新文章
- 比尔盖茨护犊子 称iPad让大批用户沮丧
- win10分辨率不能调整_图文介绍win10系统使用hdmi连接电视的处理方法
- Tensorflow【实战Google深度学习框架】预训练与微调含代码(看不懂你来打我)
- java篇 之 ==与equals
- 浏览器的内核及版本的判断
- linux启动报错+centos关闭和开启ipv6
- CLR运行时细节 - Method Descriptor
- SQL Server 2005中的ROW_NUMBER和RANK
- matlab中instr,MATLAB 串口通信
- 复旦博士用130行代码搞定核酸统计,2分钟解决人工一小时工作量
- (转)Spring Boot(二十):使用 spring-boot-admin 对 Spring Boot 服务进行监控
- 【LeetCode】7. Reverse Integer
- 白板随手一画,嗖嗖变成代码
- Java程序的编码规范
- 关于 Ping 的过程,你真的了解吗?
- linux注册节点报错,Linux 运维4月17日 5.102-5.103
- 算法的定义、特征及其算法设计的要求
- 福昕高级PDF 专业版程序安装及注意事项
- 51c语言编程入门教程,51单片机C语言入门教程
- 【强化学习】⚠️手把手带你走进强化学习 3⚠️ OPP 算法实现月球登陆器 (Tensorflow2 版)
热门文章
- 软著申请技巧及注意事项
- python3中unicode-objects must be encoded before hashing问题
- 第一行代码-第二版(郭霖著)笔记三(UI控件)
- Vant => van-field校验手机号 邮箱校验
- uni-app中使用腾旭位置服务,实现周边搜索功能,并获取到前往对应位置所需的时间(步行或驾车)
- python实训日志_最新Python实训周总结
- PS2021安装方法(附个人详细安装教程)
- 转:让老板头疼的90后,管不得?
- 快速申请注册微信小程序的方法
- 三菱数据移位指令_三菱FX系列PLC循环与移位类指令的使用方法