pat 天梯团体赛练习-l2-019 悄悄关注
来源:互联网 发布:微信摇塞子作弊软件 编辑:程序博客网 时间:2024/05/17 07:39
这道题本身没有什么难度,主要是熟悉下stl的用法。原来map
#include <iostream>#include <algorithm>#include <set>#include <map>#include <string>#include <stdio.h>#include <stdlib.h>#include <string.h>using namespace std;const int N = 10000+10;struct Note{ char str[10];};Note dirt_ans[N];set<string> dirt_have;map<string,int> dirt_zhan;int main(){ int n,m,i,j; while(~scanf("%d",&n)) { dirt_have.clear(); dirt_zhan.clear(); char str[10]; for(i=0; i<n; i++) { scanf(" %s",str); dirt_have.insert(str); } scanf("%d",&m); int iver = 0,a; for(i=0; i<m; i++) { scanf(" %s%d",str,&a); dirt_zhan[str] = a; iver += a; } int ans = 0; iver /= m; map<string,int>::iterator it; for(it=dirt_zhan.begin(); it!=dirt_zhan.end(); it++) { if(dirt_have.count(it->first)==0 && dirt_zhan[it->first]>iver) strcpy(dirt_ans[ans++].str,it->first.c_str()); } for(i=0; i<ans; i++) cout<<dirt_ans[i].str<<endl; if(ans == 0) cout<<"Bing Mei You"<<endl; } return 0;}
0 0
- pat 天梯团体赛练习-l2-019 悄悄关注
- 团体程序设计天梯赛L2-019 悄悄关注
- 2017 C4天梯 L2-019. 悄悄关注
- L2-3悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- L2-019. 悄悄关注
- PAT-天梯赛练习集-L2-020-功夫传人
- L2-019. 悄悄关注(2017初赛)
- pat 天梯 L2-2. 链表去重
- 【PAT天梯赛练习集L2-1】紧急救援——SPFA
- PAT 团体程序设计天梯赛-练习集 L2-006. 树的遍历【数据结构】
- PAT 团体程序设计天梯赛-练习集 L2-001. 紧急救援 【dijkstra】
- 欢迎使用CSDN-markdown编辑器
- 一次工作中程序bug的调试总结
- Foundation of Machine Learning 笔记第七部分—— VC维
- centos7安装zabbix3.0超详细步骤解析
- 菜鸟飞行记——二、jQuery miniui知识随记
- pat 天梯团体赛练习-l2-019 悄悄关注
- QDomDocument的setContent方法报错
- 设计模式--初识设计模式
- 总结--原生js实现整屏滚动及其交互效果
- Android获取手机的型号和系统版本
- 深入PHP面向对象、模式与实践——对象工具(2)
- String类的经典例子
- centos vsftp:425 failed to establish connection解决办法 (ls,dir等命令不能使用)
- 【Unity3D UGUI】事件接口(二) 鼠标按下、抬起、点击