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);
else
printf("%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;
}

stl_map,set 用法的更多相关文章

  1. EditText 基本用法

    title: EditText 基本用法 tags: EditText,编辑框,输入框 --- EditText介绍: EditText 在开发中也是经常用到的控件,也是一个比较必要的组件,可以说它是 ...

  2. jquery插件的用法之cookie 插件

    一.使用cookie 插件 插件官方网站下载地址:http://plugins.jquery.com/cookie/ cookie 插件的用法比较简单,直接粘贴下面代码示例: //生成一个cookie ...

  3. Java中的Socket的用法

                                   Java中的Socket的用法 Java中的Socket分为普通的Socket和NioSocket. 普通Socket的用法 Java中的 ...

  4. [转载]C#中MessageBox.Show用法以及VB.NET中MsgBox用法

    一.C#中MessageBox.Show用法 MessageBox.Show (String) 显示具有指定文本的消息框. 由 .NET Compact Framework 支持. MessageBo ...

  5. python enumerate 用法

    A new built-in function, enumerate() , will make certain loops a bit clearer. enumerate(thing) , whe ...

  6. [转载]Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法总结

    本文对Jquery中$.get(),$.post(),$.ajax(),$.getJSON()的用法进行了详细的总结,需要的朋友可以参考下,希望对大家有所帮助. 详细解读Jquery各Ajax函数: ...

  7. 【JavaScript】innerHTML、innerText和outerHTML的用法区别

    用法: <div id="test">   <span style="color:red">test1</span> tes ...

  8. chattr用法

    [root@localhost tmp]# umask 0022 一.chattr用法 1.创建空文件attrtest,然后删除,提示无法删除,因为有隐藏文件 [root@localhost tmp] ...

  9. 萌新笔记——vim命令“=”、“d”、“y”的用法(结合光标移动命令,一些场合会非常方便)

    vim有许多命令,网上搜有一堆贴子.文章列举出各种功能的命令. 对于"="."d"."y",我在无意中发现了它们所具有的相同的一些用法,先举 ...

随机推荐

  1. Oracle 10g体系机构及安全管理《思维导图》

    通过学习Oracle数据库后,我对数据库又有了进一步的了解,Oracle数据库 10g体系机构分为 物理和逻辑存储结构. 下面是我对Oracle数据库做的思维导图和笔记 (全屏查看:<思维导图& ...

  2. COM组件开发实践(七)---多线程ActiveX控件和自动调整ActiveX控件大小(上)

    声明:本文代码基于CodeProject的文章<A Complete ActiveX Web Control Tutorial>修改而来,因此同样遵循Code Project Open L ...

  3. JS Message 网页消息提醒

    JS message是一个非常小的(用gzip压缩之后才3kb)JavaScript library 用于轻松在网页上展示通知提醒.除了通知,它还支持创建带风格的对话框和确认对话框.不需要任何JS框架 ...

  4. LeeCode-Number of 1 Bits

    Write a function that takes an unsigned integer and returns the number of ’1' bits it has For exampl ...

  5. Radar Installation(贪心,可以转化为今年暑假不ac类型)

    Radar Installation Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 20000/10000K (Java/Other) ...

  6. 【v2.x OGE教程 20】粒子效果

    1.介绍 粒子系统表示三维计算机图形学中模拟一些特定的模糊现象的技术.而这些现象用其他传统的渲染技术难以实现的真实感的 game physics.常常使用粒子系统模拟的现象有火.爆炸.烟.水流.火花. ...

  7. QUdpSocket Class

    翻译自:QT官网文档QUdpSocket类 QUdpSocket类提供一个UDP套接字. Header: #include <QUdpSocket> qmake: QT += networ ...

  8. WinForm RDLC SubReport Step by step

    最近在做的一个PO管理系统,因为要用到订单打印,没有用水晶报表,直接使用VS2010的Reporting.参考了网上的一些文章,但因为找到的数据是用于WebForm的,适配到WinForm有点区别,竟 ...

  9. Unique Binary Search Trees In JAVA

    Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For examp ...

  10. hdu3123GCC

    Problem Description The GNU Compiler Collection (usually shortened to GCC) is a compiler system prod ...