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


Problem Description
There is a graph of n vertices which are indexed from 1 to n. For any pair of different vertices, the weight of the edge between them is the least common multiple of their indexes.

Mr. Frog is wondering about the total weight of the minimum spanning tree. Can you help him?
 

Input
The first line contains only one integer T (T≤100),
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.
 

Output
For each test case, output one line "Case #x:y",where x is the case number (starting from 1) and y is the total weight of the minimum spanning tree.
 

Sample Input

2
2
3
 

Sample Output

Case #1: 2
Case #2: 5

Hint

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.

 

Source

思路:水题,注意变量类型设为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的更多相关文章

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

  2. HDU 5019 Revenge of GCD(数学)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5019 Problem Description In mathematics, the greatest ...

  3. L - Abbott's Revenge(比较复杂的bfs)

    Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Practice UV ...

  4. hdu 4099 Revenge of Fibonacci 大数+压位+trie

    最近手感有点差,所以做点水题来锻炼一下信心. 下周的南京区域赛估计就是我的退役赛了,bless all. Revenge of Fibonacci Time Limit: 10000/5000 MS ...

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

  6. HDU5087——Revenge of LIS II(BestCoder Round #16)

    Revenge of LIS II Problem DescriptionIn computer science, the longest increasing subsequence problem ...

  7. HDU5086——Revenge of Segment Tree(BestCoder Round #16)

    Revenge of Segment Tree Problem DescriptionIn computer science, a segment tree is a tree data struct ...

  8. UVA 816 - Abbott&#39;s Revenge(BFS)

    UVA 816 - Abbott's Revenge option=com_onlinejudge&Itemid=8&page=show_problem&category=59 ...

  9. hdu 4099 Revenge of Fibonacci Trie树与模拟数位加法

    Revenge of Fibonacci 题意:给定fibonacci数列的前100000项的前n位(n<=40);问你这是fibonacci数列第几项的前缀?如若不在前100000项范围内,输 ...

随机推荐

  1. [bzoj2150]部落战争_二分图最小路径覆盖

    部落战争 bzoj-2150 题目大意:题目链接. 注释:略. 想法: 显然是最小路径覆盖,我们知道:二分图最小路径覆盖等于节点总数-最大匹配. 所以我们用匈牙利或者dinic跑出最大匹配,然后用总结 ...

  2. codevs——1385 挤牛奶

    1385 挤牛奶 USACO  时间限制: 1 s  空间限制: 128000 KB  题目等级 : 青铜 Bronze 题解  查看运行结果     题目描述 Description 三个农民每天清 ...

  3. SPOJ SUMPRO(数学)

    题意: 给出一个数N,问所有满足n/x=y(此处为整除)的所有x*y的总和是多少.对答案mod(1e9+7). 1 <= T <= 500. 1 <= N <= 1e9. 分析 ...

  4. redhat 6 配置 yum 源

    1.删除redhat原有的yum rpm -aq|grep yum|xargs rpm -e --nodeps 2.下载yum安装文件 注意,如果下载时找不到文件,就登录到:http://mirror ...

  5. Java ThreadLocal 使用详解

    ThreadLocal的官方API解释为: "该类提供了线程局部 (thread-local) 变量.这些变量不同于它们的普通对应物,因为访问某个变量(通过其 get 或 set 方法)的每 ...

  6. Android GIS开发系列-- 入门季(8) Json与Geometry的相互转换

    在Android中json数据十分普遍,也很实用,在Arcgis中也同样支持Json数据,Json与Geometry可以相互转换,达到我们想要的数据. 一.Geometry转换成Json数据 这个实现 ...

  7. Django学习系列之中间件

    中间件的定义 中间件是一个.一个的管道,如果相对任何所有的通过Django的请求进行管理都需要自定义中间件 中间件可以对进来的请求和出去的请求进行控制 中间件是一类 django请求生命周期 自定义中 ...

  8. 【c语言】统计一个数字在排序数组中出现的次数

    // 题目:统计一个数字在排序数组中出现的次数. //  比如:排序数组{1.2,3,3,3,3,4.5}和数字3,因为3出现了4次.因此输出4 有一种最简单的算法,遍历.可是有比它效率更高的 先看遍 ...

  9. Nginx + FastCgi + Spawn-fcgi + C 架构的server环境搭建

    1.Nginx 1.1.安装 Nginx 的中文维基 http://wiki.codemongers.com/NginxChs 下载 Nginx 0.6.26(开发版)(请下载最新版本号) tar z ...

  10. tomcat的HTTPS

    完美配置Tomcat的HTTPS 博客分类: Tomcat HTTPS   Tomcat配置HTTPS的文章到处都有,过程也比较简单,随后文中会转一段过来. 但对于启用APR情况下报异常“java.l ...