hdoj 1977 Consecutive sum II
Consecutive sum II
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2523 Accepted Submission(s):
1219
~~
1 = 0 + 1
2+3+4 = 1 + 8
5+6+7+8+9 = 8 + 27
…
You can
see the consecutive sum can be representing like that. The nth line will have
2*n+1 consecutive numbers on the left, the first number on the right equal with
the second number in last line, and the sum of left numbers equal with two
number’s sum on the right.
Your task is that tell me the right numbers in the
nth line.
follow.
Each line will contain an integer N (0 <= N <=
2100000).
line.
All answer in the range of signed 64-bits integer.
#include<stdio.h>
#include<string.h>
int main()
{
long long m,n;
scanf("%lld",&n);
while(n--)
{
scanf("%lld",&m);
printf("%lld %lld\n",m*m*m,(m+1)*(m+1)*(m+1));
}
return 0;
}
hdoj 1977 Consecutive sum II的更多相关文章
- HDOJ(HDU) 1977 Consecutive sum II(推导、、)
Problem Description Consecutive sum come again. Are you ready? Go ~~ 1 = 0 + 1 2+3+4 = 1 + 8 5+6+7+8 ...
- Leetcode 笔记 113 - Path Sum II
题目链接:Path Sum II | LeetCode OJ Given a binary tree and a sum, find all root-to-leaf paths where each ...
- Path Sum II
Path Sum II Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals ...
- [leetcode]Path Sum II
Path Sum II Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals ...
- 【leetcode】Path Sum II
Path Sum II Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals ...
- 32. Path Sum && Path Sum II
Path Sum OJ: https://oj.leetcode.com/problems/path-sum/ Given a binary tree and a sum, determine if ...
- LeetCode: Path Sum II 解题报告
Path Sum II Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals ...
- 【leetcode】Combination Sum II
Combination Sum II Given a collection of candidate numbers (C) and a target number (T), find all uni ...
- [LeetCode] #167# Two Sum II : 数组/二分查找/双指针
一. 题目 1. Two Sum II Given an array of integers that is already sorted in ascending order, find two n ...
随机推荐
- jquery , find the event handler,找到jquery中的event handler
找到 dispatch: function (e) { e = b.event.fix(e); var n, r, i, s, o, u = [], a = d.call(arguments), f ...
- List<>过滤重复的简单方法
List<int> ss = new List<int>(); ss.Add(); ss.Add(); ss.Add(); ss.Add(); ss.Add(); ss.Add ...
- spoj LCS
初识后缀自动机: 推荐学习:http://blog.sina.com.cn/s/blog_7812e98601012dfv.html #include<cstdio> #include&l ...
- 1089-Duplicate Removal
描述 The company Al's Chocolate Mangos has a web site where visitors can guess how many chocolate cove ...
- java static 变量,和方法从属于类
第36集 java static 变量,和方法从属于类 可以用类来直接调用static属性和方法 static方法不能调用非静态的属性和方法,反之可以 new产生的对象,不包括static 属性和方法
- 【Xamarin挖墙脚系列:IOS-关于手机支持的屏幕方向】
原文:[Xamarin挖墙脚系列:IOS-关于手机支持的屏幕方向] 设置支持的屏幕方向有两个级别,一个是app级别的,另一个是viewController级别的. app 级别的可以在[target] ...
- poj1724ROADS(BFS)
链接 本来想写spfa 加点什么限制什么的可能就过了 写着写着就成裸BFS了 也没优化就水过了 #include <iostream> #include<cstdio> #in ...
- MS-DOS 7.10完整安装版(含图文安装程序)
大家知道,要想学习或使用DOS,安装一个DOS并进行实际操作是非常必要的.MS-DOS 7.10是一个非常好且强大实用的操作系统,而且兼容性和性能都十分强.要在系统中安装MS-DOS 7.10,可以使 ...
- 自定义web服务器(四)
关于HTTP协议的具体内容,前面章节已经有所讲解,相信读者已有所了解,在此不在累述,本章节讲解自定义web服务器. 一,.net提供自定义Web服务器的类 以下只是写主要的类 1.HTTPListe ...
- 对XX证券报关于物联网操作系统的几个问题的答复
XX证券报提问了几个关于物联网和物联网操作系统的问题,个人表达了一些粗陋的观点,在这里发表出来,与行业朋友交流和探讨. 物联网行业最需要解决的问题是什么? 虽然物联网这个行业被炒得比较热,但是截至目前 ...