BestCoder Round #92 (hdu_6015 6016)
A题主要是map的使用,比赛的时候问了下队友,下次要记住了
#include<bits/stdc++.h>
using namespace std;
typedef long long LL; LL T,n;
map<string,int> mp1,mp2; int main()
{
cin>>T;
while(T--)
{
mp1.clear();mp2.clear();
cin>>n;
for(int i=;i<n;i++)
{
string str;
int t;
cin>>str>>t;
if(mp1[str]<t)
{
mp2[str]=mp1[str];
mp1[str]=t;
}
else if(mp2[str]<t)
{
mp2[str]=t;
}
}
int ans=;
for(map<string,int>::iterator it=mp1.begin();it!=mp1.end();++it)
ans+=it->second;
for(map<string,int>::iterator it=mp2.begin();it!=mp2.end();++it)
ans+=it->second;
cout<<ans<<endl;
}
}
hdu_6015
B题算是道组合数学吧,枚举可能满足条件的 -B-C- (也即-C-B),以BC为中间二点的满足条件的序列数=(du[B]-1)*(du[C]-1)*2
#include<bits/stdc++.h>
using namespace std;
typedef long long LL; LL du[];
struct Edge
{
LL u,v;
}e[]; int main()
{
ios::sync_with_stdio(false);cin.tie();
LL T,n,m,k;
cin>>T;
while(T--)
{
memset(du,,sizeof(du));
cin>>n>>m>>k;
for(int i=;i<k;i++)
{
LL u,v;
cin>>u>>v;
du[u]++,du[n+v]++;
e[i]=(Edge){u,v+n};
}
LL ans=;
for(int i=;i<k;i++)
ans+=(du[e[i].u]-)*(du[e[i].v]-)*;
cout<<ans<<endl;
}
}
hdu_6016
BestCoder Round #92 (hdu_6015 6016)的更多相关文章
- BestCoder Round #92 (hdu 6015 6016)
		
比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long l ...
 - BestCoder Round #92 比赛记录
		
上午考完试后看到了晚上的BestCoder比赛,全机房都来参加 感觉压力好大啊QAQ,要被虐了. 7:00 比赛开始了,迅速点进了T1 大呼这好水啊!告诉了同桌怎么看中文题面 然后就开始码码码,4分1 ...
 - BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器
		
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...
 - BestCoder Round #92 1002 Count the Sheep —— 枚举+技巧
		
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1002 题解: 做题的时候只是想到 ...
 - HDU_6016_(Bestcoder round #92 1002)_(dfs)(暴力)
		
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6016 题意:给定男羊和女羊的朋友关系,即给定一个图,问从任意一只羊开始连续数四只不相同的羊的方法数. ...
 - BestCoder Round #92
		
这里是逢比赛必挂的智障选手ysf…… 不知道是因为自己菜还是心态不好……也许是后者吧,毕竟每次打比赛的时候都会很着急.lrd说我打比赛的功利性太强,想想确实是这样. 昨天打完之后自觉身败名裂没敢写出来 ...
 - [BestCoder Round #3] hdu 4908 BestCoder Sequence (计数)
		
BestCoder Sequence Problem Description Mr Potato is a coder. Mr Potato is the BestCoder. One night, ...
 - BestCoder Round #89  02单调队列优化dp
		
1.BestCoder Round #89 2.总结:4个题,只能做A.B,全都靠hack上分.. 01 HDU 5944 水 1.题意:一个字符串,求有多少组字符y,r,x的下标能组成等比数列 ...
 - BestCoder Round #90  //div all 大混战 一题滚粗  阶梯博弈,树状数组,高斯消元
		
BestCoder Round #90 本次至少暴露出三个知识点爆炸.... A. zz题 按题意copy Init函数 然后统计就ok B. 博弈 题 不懂 推了半天的SG..... 结果这 ...
 
随机推荐
- cs6安装
			
[按下面步骤操作 无需序列号] ·打上补丁 永远无需序列号 (现在网上没什么能用的序列号) ·1双击CS软件安装,选择试用 ·2创建ID 输入自己邮箱和密码,姓名可以随意输入 ·3安装完成后 运行一次 ...
 - FPGA设计思想(持续更新)
			
一. 流水线设计 将原本一个时钟周期完成的较大的组合逻辑通过合理的切割后分由多个时钟周期完成.该部分逻辑运行的时钟频率会有明显对的提升,提高系统的性能用面积换速度 一个流水线设计需要4个步骤完成一个数 ...
 - java 1.8 动态代理源码分析
			
JDK8动态代理源码分析 动态代理的基本使用就不详细介绍了: 例子: class proxyed implements pro{ @Override public void text() { Syst ...
 - Spring学习(21)--- AOP之Advice应用(上)
			
前置通知(Before advice) 在某个连接点(join point)之前执行的通知,但不能阻止连接点前的执行(除非它抛出异常) 返回后通知(After returning advice) 在某 ...
 - scrapy调试时出现  ImportError: No module named win32api
			
windows下利用scrapy(python2.7)写爬虫,运行 scrapy crawl dmoz 命令时提示:exceptions.ImportError: No module named wi ...
 - 用require.js封装原生js轮播图
			
index.html页面: <!DOCTYPE html><html> <head> <meta charset="UTF-8"> ...
 - 使用HttpClient 调用Web Api
			
C#4.5 添加了异步调用Web Api . 如果你的项目是4.5以上版本,可以直接参考官方文档. http://www.asp.net/web-api/overview/web-api-client ...
 - css__金属质感的文字
			
金属质感的文字 网上看到的优秀思想!神奇的css~~~~ css div.a { width: 300px; text-align: center; color: white; background: ...
 - Chapter 2. Video Formats and Quality
			
本章节主要介绍一些视频格式相关的基础知识. 交织(Interlace) 即每一个采样帧采样时隔行采样,奇数行和偶数行交替. YCbCr 人眼视觉系统(Human Visual System, HVS) ...
 - 关于 静态页面布局 中的一些BUG
			
作为一枚初级程序猿,难免在制作静态页面时会遇到一些BUG,在此,我从网上找了一些资料并且结合自己的项目开发经验,总结了一些在静态页面布局时可能会遇到的问题,希望能对初级程序猿有一定的帮助(资料请参考: ...