Rikka with Graph

思路:

官方题解:

代码:

#include<bits/stdc++.h>
using namespace std;
#define ll long long int main()
{
int t;
scanf("%d",&t);
while(t--)
{
ll n,m,ans;
scanf("%lld%lld",&n,&m);
if(m<n-)
{
ans=m*+(m-)*m*+(n*(n-)-m*-(m-)*m)*n;
}
else if(m<n*(n-)/)
{
ans=(n-)*+(n-)*(n-)*;
ll t=m-(n-);
ans-=t*;
}
else
{
ans=(n-)*n;
}
printf("%lld\n",ans);
}
return ;
}

HDU 6090 Rikka with Graph的更多相关文章

  1. HDU 6090 Rikka with Graph —— 2017 Multi-University Training 5

    Rikka with Graph Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  2. HDU 5631 Rikka with Graph 暴力 并查集

    Rikka with Graph 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5631 Description As we know, Rikka ...

  3. HDU 5422 Rikka with Graph

    Rikka with Graph Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  4. HDU 5424——Rikka with Graph II——————【哈密顿路径】

    Rikka with Graph II Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Othe ...

  5. hdu 5424 Rikka with Graph II(dfs+哈密顿路径)

    Problem Description   As we know, Rikka is poor at math. Yuta is worrying about this situation, so h ...

  6. hdu 5422 Rikka with Graph(简单题)

    Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, so he ...

  7. 2017ACM暑期多校联合训练 - Team 5 1006 HDU 5205 Rikka with Graph (找规律)

    题目链接 Problem Description As we know, Rikka is poor at math. Yuta is worrying about this situation, s ...

  8. hdu 5424 Rikka with Graph II (BestCoder Round #53 (div.2))(哈密顿通路判断)

    http://acm.hdu.edu.cn/showproblem.php?pid=5424 哈密顿通路:联通的图,访问每个顶点的路径且只访问一次 n个点n条边 n个顶点有n - 1条边,最后一条边的 ...

  9. HDU 5424 Rikka with Graph II

    题目大意: 在 N 个点 N 条边组成的图中判断是否存在汉密尔顿路径. 思路:忽略重边与自回路,先判断是否连通,否则输出"NO",DFS搜索是否存在汉密尔顿路径. #include ...

随机推荐

  1. font-awesome图标

  2. DIV CSS 绘制风车

    我得说,CSS和DIV是个有趣的东西. 由于脑袋一无聊,突然想,画个DIV风车怎么样,于是就画了一个. border的风格可以自主选择. 上代码: <style> *{ margin:0p ...

  3. [WPF]WPF开发方法论

    纵观Windows GUI应用程序开发方法,从Windows API.MFC到Visual Basic再到.NET Framework,WPF的开发方法论是在.NET Framework方法论的基础上 ...

  4. Impala SQL 语言元素(翻译)[转载]

    原 Impala SQL 语言元素(翻译) 本文来源于http://my.oschina.net/weiqingbin/blog/189413#OSC_h2_2 摘要 http://www.cloud ...

  5. linux常用命令:ifconfig 命令

    许多windows非常熟悉ipconfig命令行工具,它被用来获取网络接口配置信息并对此进行修改.Linux系统拥有一个类似的工具,也就是ifconfig(interfaces config).通常需 ...

  6. 处理内容有&特殊字符thinkphp返回xml无法解析的问题<![CDATA[xxx]]>

    处理内容有&特殊字符thinkphp返回xml无法解析的问题<![CDATA[xxx]]> // xml 转义特殊字符 如&'" <![CDATA[&quo ...

  7. SpringBoot之RESTFul风格的接口调用(jQuery-Ajax)

    一.Get $.ajax({ type: "get", url: "url地址", async: true, dataType:"json" ...

  8. Python3 识别验证码(opencv-python)

    Python3 识别验证码(opencv-python) 一.准备工作 使用opencv做图像处理,所以需要安装下面两个库: pip3 install opencv-python pip3 insta ...

  9. 20145104张家明 《Java程序设计》第三次实验设计

    合作伙伴是20145103 下面是我们的git成果 首先下载他托管上去的代码 然后运行下载的代码 之后对下载的代码进行修改 然后推送上去 下载修改后的代码并运行 •软件工程是把系统的.有序的.可量化的 ...

  10. BZOJ 2434 阿狸的打字机(fail树)

    题目链接:http://61.187.179.132/JudgeOnline/problem.php?id=2434 题意:阿狸喜欢收藏各种稀奇古怪的东西,最近他淘到一台老式的打字机.打字机上只有28 ...