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 #3] hdu 4908 BestCoder Sequence (计数)
BestCoder Sequence Problem Description Mr Potato is a coder. Mr Potato is the BestCoder. One night, ...
- Bestcoder round #65 && hdu 5593 ZYB's Tree 树形dp
Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
- Bestcoder round #65 && hdu 5592 ZYB's Premutation 线段树
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...
- [BestCoder Round #3] hdu 4907 Task schedule (模拟简单题)
Task schedule Problem Description 有一台机器,而且给你这台机器的工作表.工作表上有n个任务,机器在ti时间运行第i个任务,1秒就可以完毕1个任务. 有m个询问,每一个 ...
- BestCoder Round #92 (hdu_6015 6016)
比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long l ...
- 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 比赛记录
上午考完试后看到了晚上的BestCoder比赛,全机房都来参加 感觉压力好大啊QAQ,要被虐了. 7:00 比赛开始了,迅速点进了T1 大呼这好水啊!告诉了同桌怎么看中文题面 然后就开始码码码,4分1 ...
随机推荐
- 整数解 (hdu 2092
整数解 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- hook原生打包流程
将实际执行的Transform换成了MatrixTraceTransform public static void inject(Project project, def variant) { //获 ...
- LintCode之最长单词
题目描述: 分析:先建一个数组s用来存储每个字符串的长度,然后遍历数组s得到最大的数max,这个数就是词典中的最长单词的长度,由于可能有多个长度相等的单词,所以要循环整个词典,当一个单词的长度等于ma ...
- mui初级入门教程(三)— html5+ XMLHttpRequest 与mui ajax用法详解
文章来源:小青年原创发布时间:2016-05-29关键词:mui,html5+,XMLHttpRequest,ajax,懒加载转载需标注本文原始地址: http://zhaomenghuan.gith ...
- HDU4405 Aeroplane chess (概率DP,转移)
http://acm.hdu.edu.cn/showproblem.php?pid=4405 题意:在一个1×n的格子上掷色子,从0点出发,掷了多少前进几步,同时有些格点直接相连,即若a,b相连,当落 ...
- 在windows上使用xdmcp登陆centos,红帽linux
使用xdmcp协议可以方便的在远端登陆linux服务器,进行一些界面的操作. 修改服务器端配置. vi /etc/gdm/custom.conf 找到下面两个标签 [security] AllowRe ...
- shtml与html
前言 在浏览网页的时,忽然发现了一个网址不是以[.html]结尾,而是[.shtml].顿时勾起了我的好奇心,这是什么鬼?于是打开google,开始维基. SHTML 什么是 SHTML 使用SSI( ...
- c#处理json格式类型的字符串
string channelGroup=[{"SpType":"1","BaseInfoId":["xxx"," ...
- 《JAVA设计模式》之桥接模式(Bridge)
在阎宏博士的<JAVA与模式>一书中开头是这样描述桥梁(Bridge)模式的: 桥梁模式是对象的结构模式.又称为柄体(Handle and Body)模式或接口(Interface)模式. ...
- P4158[SCOI2009]粉刷匠
题目描述 windy有 N 条木板需要被粉刷. 每条木板被分为 M 个格子. 每个格子要被刷成红色或蓝色. windy每次粉刷,只能选择一条木板上一段连续的格子,然后涂上一种颜色. 每个格子最多只能被 ...