hdu 6090 Rikka with Graph(找规律)
来源:互联网 发布:vscode js代码提示 编辑:程序博客网 时间:2024/06/07 21:53
Rikka with Graph
题目链接:Rikka with Graph
题意:给你n个顶点,让你最多建m条边,如果顶点i和顶点j连通,则他们之间的权值为最短路上边的数量,否则他们之间的权值则为n
求
思路:只要想到把这张图建成这样的,直接找规律就行了
官方题解:
代码:
#include<bits/stdc++.h>using namespace std;typedef long long LL;int main(){ int t; LL n,m,ans; scanf("%d",&t); while(t--) { scanf("%lld%lld",&n,&m); if(m<n-1) ans=n*n*(n-1)-2*(n-1)*m-(n-2)*m*(m-1); else ans=(n*(n-1)-m)*2; if(ans<n*(n-1)) ans=n*(n-1); printf("%lld\n",ans); } return 0;}
阅读全文
1 0
- -----找规律 hdu 6090-Rikka with Graph
- hdu 6090 Rikka with Graph(找规律)
- HDU 6090 Rikka with Graph(规律)
- hdu6090 Rikka with Graph (找规律)
- HDU 6090 Rikka with Graph【规律】
- HDU 6090 Rikka with Graph (图论规律题)
- HDU6090 Rikka with Graph 找规律签到
- HDU 5422-Rikka with Graph(规律题)
- HDU 5422 Rikka with Graph(规律)
- HDU 6090 Rikka with Graph(思维)
- Rikka with Graph(HDU 6090)
- HDU 6090 Rikka with Graph(构造)
- HDU 6090 Rikka with Graph
- HDU 6090 Rikka with Graph
- [HDU 6090]Rikka with Graph
- hdu 6090 Rikka with Graph
- HDU 6090 Rikka with Graph
- HDU 6090 Rikka with Graph
- MyEclipse启动:Could not create the view: An unexpected exception was thrown.
- 你需要理解的Java反射机制知识总结
- 初始Python
- SpringMVC的解释与搭建Maven私有代理服务器
- JavaWeb中监听器+过滤器+拦截器区别、配置和实际应用
- hdu 6090 Rikka with Graph(找规律)
- 初识RequireJS
- MySql CURSOR+LOOP循环-使用小实例
- 七种重要的模型验证错误矩阵
- 正式开始写自己的博客
- AVL树
- Java内部类的使用小结
- hdu 1867 kmp A + B for you again
- POJ -3468- A Simple Problem with Integers (线段是区间修改)