hdu5922Minimum’s Revenge
Minimum’s Revenge
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1409 Accepted Submission(s): 749
Mr. Frog is wondering about the total weight of the minimum spanning tree. Can you help him?
which indicates the number of test cases.
For each test case, the first line contains only one integer n (2≤n≤109),
indicating the number of vertices.
2
3
Case #2: 5
In the second sample, the graph contains 3 edges which are (1, 2, 2), (1, 3, 3) and (2, 3, 6). Thus the answer is 5.
思路:水题,注意变量类型设为long long
#include <iostream>
#include<stdio.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
long long n;
int path=1;
while(t--)
{
scanf("%lld",&n);
long long sum=0;
sum=((2+n)*(n-1))/2;
printf("Case #%d: %lld\n",path++,sum);
}
return 0;
}
hdu5922Minimum’s Revenge的更多相关文章
- HDU 3341 Lost's revenge(AC自动机+DP)
Lost's revenge Time Limit: 15000/5000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others)T ...
- HDU 5019 Revenge of GCD(数学)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5019 Problem Description In mathematics, the greatest ...
- L - Abbott's Revenge(比较复杂的bfs)
Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UV ...
- hdu 4099 Revenge of Fibonacci 大数+压位+trie
最近手感有点差,所以做点水题来锻炼一下信心. 下周的南京区域赛估计就是我的退役赛了,bless all. Revenge of Fibonacci Time Limit: 10000/5000 MS ...
- HDU5088——Revenge of Nim II(高斯消元&矩阵的秩)(BestCoder Round #16)
Revenge of Nim II Problem DescriptionNim is a mathematical game of strategy in which two players tak ...
- HDU5087——Revenge of LIS II(BestCoder Round #16)
Revenge of LIS II Problem DescriptionIn computer science, the longest increasing subsequence problem ...
- HDU5086——Revenge of Segment Tree(BestCoder Round #16)
Revenge of Segment Tree Problem DescriptionIn computer science, a segment tree is a tree data struct ...
- UVA 816 - Abbott's Revenge(BFS)
UVA 816 - Abbott's Revenge option=com_onlinejudge&Itemid=8&page=show_problem&category=59 ...
- hdu 4099 Revenge of Fibonacci Trie树与模拟数位加法
Revenge of Fibonacci 题意:给定fibonacci数列的前100000项的前n位(n<=40);问你这是fibonacci数列第几项的前缀?如若不在前100000项范围内,输 ...
随机推荐
- Codeforces 651B Beautiful Paintings【贪心】
题意: 给定序列,重新排序,使严格上升的子序列最多.求这些子序列总长度. 分析: 贪心,统计每个元素出现次数,每次从剩余的小的开始抽到大的,直到不再剩余元素. 代码: #include<iost ...
- python dos2unix
有时你在windows上创建的文件拿到Linux/unix上运行会出错, 这是因为windows上有些字符如换行符在linux/unix不识别.这种情况下需要用dos2unix这个工具把文件转换成li ...
- 如何利用神经网络和Python生成指定模式的密码
今天给大家介绍的是Github上一个名叫PyMLProjects的项目,这个项目的目的是为了训练AI来学习人类构造密码的模式,然后我们就可以用AI来生成大量同一模式或种类的密码了.这种方法也许可以用来 ...
- ImportError: No module named MySQLdb解决办法
http://blog.slogra.com/post-429.html http://blog.sina.com.cn/s/blog_74a7e56e0101a7qy.html 今天突发奇想在服务器 ...
- CentOS 7 防火墙开启了哪些服务和端口?
过滤封包功能的 netfilter 已经内建在 CentOS 7 的内核,但是配置 netfilter 的界面程式 firewalld 却未必有安装,不论是否已经安装,都可以执行下面的安装指令: yu ...
- 指针数组,数组指针,函数指针,main函数实质,二重指针,函数指针作为參数,泛型函数
1.指针数组 数组里面的每一个元素都是指针. 指针数组的案比例如以下: 易犯错误: 2.数组指针 归根结底还是指针,仅仅是取*的时候可以取出一整个数组出来. 数组指针:(一个指针指向了数组.一般 ...
- qq xxs
qq xxs qq xxs 有很多举个简单例子 : QQ空间发段文章 带上 <script> 提交(document.cookie) 到 自己服务端获取 </script> 在 ...
- JavaScript中的string interpolation
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals var a = 5; var b ...
- js二维数组定义和初始化的三种方法总结
js二维数组定义和初始化的三种方法总结 方法一:直接定义并且初始化,这种遇到数量少的情况可以用var _TheArray = [["0-1","0-2"],[& ...
- HTTP权威指南阅读记录 - 第一章
最近终于开始看<HTTP权威指南>了,第一章主要是简介一些基本的概念.下面列出一些常用,但还不是很了解的简单概念. 一.常见概念: 1.媒体类型 因特网上有数千种不同的数据类型,HTTP仔 ...