stl_map,set 用法
来源:互联网 发布:下载免费打电话软件 编辑:程序博客网 时间:2024/05/21 09:05
set:
集合a,b加起来,去重
hdu 1406
#include <iostream>#include<cstdio>#include<set>using namespace std;int main(int argc, char** argv) {set<int> s;set<int>:: iterator cp;int a,b,n;while(scanf("%d%d",&a,&b)!=EOF){s.clear();int Max=0;for(int i=0;i<a+b;i++){scanf("%d",&n);Max=(n>Max)?n:Max;s.insert(n);}for(cp=s.begin();cp!=s.end();cp++){if(*cp!=Max)printf("%d ",*cp);elseprintf("%d\n",*cp);}}return 0;}
map的用法
hdu 4802
#include <iostream>#include<cstdio>#include<cstring>#include<map>using namespace std;int main(int argc, char** argv) {int n,all,a;double gpa;char str[10];int i,j;map<string,double> mp;mp["A"]=4;mp["A-"]=3.7;mp["B+"]=3.3;mp["B"]=3;mp["B-"]=2.7;mp["C+"]=2.3;mp["C"]=2;mp["C-"]=1.7;mp["D"]=1.3;mp["D-"]=1;mp["F"]=0;while(scanf("%d",&n)!=EOF){gpa=0;all=0;while(n--){scanf("%d%s",&a,str);if(mp.find(str)!=mp.end())all+=a,gpa+=mp[str]*a;}if(gpa!=0)gpa/=all;printf("%.2lf\n",gpa);}return 0;}
0 0
- stl_map,set 用法
- STL_map用法
- STL_map用法
- STL_Map用法详解
- STL_map
- STL_map
- STL_MAP
- STL_map
- STL_map
- UVa 11572 - Unique Snowflakes (滑动窗口STL_map||set) 好题!!!
- 温故篇之STL_map,set的一些应用
- stl_map.h
- STL_map操作
- set&&<set> 用法整理
- set 用法
- set用法
- set 用法
- Set用法
- 小白之《研发工程师应聘之路》
- tox and solution for neutron tox error
- 浅谈C中的wprintf和宽字符显示【其实很深】
- SEO新手如何让“伪原创”成为“原创”
- linux awk
- stl_map,set 用法
- OpenGL学习二十七:混合
- .htaccess文件
- Eratosthenes
- upnpc
- 利用Detours STL MAP HOOK NT函数
- shell 编程
- 资源.Eclipse.相关插件下载地址
- Hbase 安装---1. 下载源文件