比赛链接

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 #92 (hdu 6015 6016)

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

  2. BestCoder Round #92 比赛记录

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

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

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

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

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

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

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

  6. BestCoder Round #92

    这里是逢比赛必挂的智障选手ysf…… 不知道是因为自己菜还是心态不好……也许是后者吧,毕竟每次打比赛的时候都会很着急.lrd说我打比赛的功利性太强,想想确实是这样. 昨天打完之后自觉身败名裂没敢写出来 ...

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

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

  8. BestCoder Round #89 02单调队列优化dp

    1.BestCoder Round #89 2.总结:4个题,只能做A.B,全都靠hack上分.. 01  HDU 5944   水 1.题意:一个字符串,求有多少组字符y,r,x的下标能组成等比数列 ...

  9. BestCoder Round #90 //div all 大混战 一题滚粗 阶梯博弈,树状数组,高斯消元

    BestCoder Round #90 本次至少暴露出三个知识点爆炸.... A. zz题 按题意copy  Init函数 然后统计就ok B. 博弈 题  不懂  推了半天的SG.....  结果这 ...

随机推荐

  1. python中xrange用法分析

    本文实例讲述了python中xrange用法.分享给大家供大家参考.具体如下: 先来看如下示例: >>> x=xrange(0,8) >>> print x xra ...

  2. Ajax请求(二)--JQuery的Ajax请求方法

    JQuery库的Ajax请求的几种方法: 1. load( url, [data], [callback] ) :载入远程 HTML 文件代码并插入至 DOM 中. 参数含义: url (String ...

  3. cpp(第八章)

    1. #include <iostream> inline int add(int &n) { n= n+; ; } int main() { using namespace st ...

  4. Java基础——继承

    学习Java继承之前,我们想回忆一下Java面向对象需要特别注意的几个关键点. 面向对象是将复杂的事情简单化了,它通过封装的方式使得代码的重用性更高和安全性更强.平时我们要学会用面向对象的方式去思考, ...

  5. 关于dubbo分享

    一.dubbo服务是基于zookeeper提供服务.提供消费 1.Zookeeper的作用: zookeeper用来注册服务和进行负载均衡,哪一个服务由哪一个机器来提供必需让调用者知道,简单来说就是i ...

  6. Linux命令 查看文件内容

    cat [功能说明] 查看文件的内容  #cat本身是一个串接命令,把指定一个或多个源文件的内容,利用>符号重定向到目标文件中,如果不指定重定向文件,则默认在标准输出设备上显示.此时,可以利用c ...

  7. php中常用的处理字符串的函数

    1.将字符串转换为数组的函数:str_split() array str_split ( string $string [, int $split_length = 1 ] ) string:输入字符 ...

  8. jQuery Ajax封装(附带加载提示和请求结果提示模版)

    1.创建HTML文件(demo) <!doctype html> <html lang="en"> <head> <meta charse ...

  9. el 表达式遍历Map

    el 表达式遍历Map<c:forEach var="item" items="${payMentMap}"> <option value=& ...

  10. [LeetCode] Friend Circles 朋友圈

    There are N students in a class. Some of them are friends, while some are not. Their friendship is t ...