比赛链接

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)的更多相关文章

  1. [BestCoder Round #3] hdu 4908 BestCoder Sequence (计数)

    BestCoder Sequence Problem Description Mr Potato is a coder. Mr Potato is the BestCoder. One night, ...

  2. 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 ...

  3. Bestcoder round #65 && hdu 5592 ZYB's Premutation 线段树

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submissio ...

  4. [BestCoder Round #3] hdu 4907 Task schedule (模拟简单题)

    Task schedule Problem Description 有一台机器,而且给你这台机器的工作表.工作表上有n个任务,机器在ti时间运行第i个任务,1秒就可以完毕1个任务. 有m个询问,每一个 ...

  5. BestCoder Round #92 (hdu_6015 6016)

    比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long l ...

  6. BestCoder Round #92 1001 Skip the Class —— 字典树 or map容器

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1001 题解: 1.trie树 关 ...

  7. BestCoder Round #92 1002 Count the Sheep —— 枚举+技巧

    题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1002 题解: 做题的时候只是想到 ...

  8. HDU_6016_(Bestcoder round #92 1002)_(dfs)(暴力)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6016 题意:给定男羊和女羊的朋友关系,即给定一个图,问从任意一只羊开始连续数四只不相同的羊的方法数. ...

  9. BestCoder Round #92 比赛记录

    上午考完试后看到了晚上的BestCoder比赛,全机房都来参加 感觉压力好大啊QAQ,要被虐了. 7:00 比赛开始了,迅速点进了T1 大呼这好水啊!告诉了同桌怎么看中文题面 然后就开始码码码,4分1 ...

随机推荐

  1. [NOIP2016]蚯蚓 题解

    题目描述 本题中,我们将用符号[c]表示对c向下取整,例如:[3.0」= [3.1」= [3.9」=3.蛐蛐国最近蚯蚓成灾了!隔壁跳蚤国的跳蚤也拿蚯蚓们没办法,蛐蛐国王只好去请神刀手来帮他们消灭蚯蚓. ...

  2. CSU 1547 Rectangle(dp、01背包)

    题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1547 Description Now ,there are some rectang ...

  3. scau 1079 三角形(暴力)

    </pre>1079 三角形</h1></center><p align="center" style="margin-top: ...

  4. python使用中遇到的一些问题

    一./usr/bin/ld:cannot find -lxxx错误 例如出现了问题: /usr/bin/ld:cannot find -lssl 其中xxx表示函式库文件名称,如上面的libssl.s ...

  5. Docker 里面新建mysql 容器

    1.获取MySQL镜像, a.直接从docker hub 下载docker镜像 docker pull +镜像名称 b.从别的项目上把镜像export出来 dockr load  i + 镜像的TAR ...

  6. pandas melt 与pivot 函数

    (掌握这个,基本就完美无缺的任意按照自己的想法,更改列了.) 背景: 最近有个excel 数据需要转化的过程. 数据量还挺大的,大概有30多万. 需要把某些行变成列,有些列又变成行. 这个操作本身就比 ...

  7. git报错-Initial commit Untracked files nothing added to commit but untracked ……

    文章转自 https://www.jianshu.com/p/61c3db30d488 在目标执行命令 git stratus 报错 根据上面的文章,可以解决问题.不行的话,请留言. 感谢你的阅读

  8. python支持的进程与线程

    一.multiprocessing模块介绍 python中的多线程无法利用CPU资源,在python中大部分情况使用多进程.python中提供了非常好的多进程包multiprocessing. mul ...

  9. 《JAVA设计模式》之模板模式(Template)

    在阎宏博士的<JAVA与模式>一书中开头是这样描述模板方法(Template Method)模式的: 模板方法模式是类的行为模式.准备一个抽象类,将部分逻辑以具体方法以及具体构造函数的形式 ...

  10. [Linux] 027 RPM 包与 源码包的区别

    1. 区别 安装之前的区别: 概念上的区别 安装之后的区别: 安装位置不同 2. RPM 包安装位置 安装在默认位置中 RPM 包默认安装路径 明细 /ect 配置文件安装目录 /usr/bin/ 可 ...