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

Problem Description
Consecutive sum come again. Are you ready? Go
~~
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.
 
Input
The first integer is T, and T lines will
follow.
Each line will contain an integer N (0 <= N <=
2100000).
 
Output
For each case, output the right numbers in the Nth
line.
All answer in the range of signed 64-bits integer.
 
Sample Input
3
0
1
2
 
Sample Output
0 1
1 8
8 27
 
找规律
#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的更多相关文章

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

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

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

  4. [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 ...

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

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

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

  8. 【leetcode】Combination Sum II

    Combination Sum II Given a collection of candidate numbers (C) and a target number (T), find all uni ...

  9. [LeetCode] #167# Two Sum II : 数组/二分查找/双指针

    一. 题目 1. Two Sum II Given an array of integers that is already sorted in ascending order, find two n ...

随机推荐

  1. Ubuntu安装提示Permission Denied

    我用wubi安装ubuntu 显示 permission denied 并要查看日志文件 怎么办啊? 你好,你把你的ISO放到你的Wubi目录下面,也就是把镜像放到你解压好的文件夹里面就可以了呢!! ...

  2. UVA 11739 Giving Candies

    求最大的公共前缀: 用后缀数组做: 其实暴力也可以过: #include<cstdio> #include<cstring> #include<algorithm> ...

  3. top 10 js mvc

    http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/ http://www.iteye.com/new ...

  4. HDU4527+BFS

    模拟BFS搜索 对于一个将要爆炸的点,可能同时由多个点引起. /* 模拟搜索过程 */ #include<stdio.h> #include<stdlib.h> #includ ...

  5. http://blog.csdn.net/shirdrn/article/details/6270506

    http://blog.csdn.net/shirdrn/article/details/6270506

  6. UIcollectionView的使用(首页的搭建4)

    2.5 头部视图

  7. cocos-html5 Json 灵活 遍历方式 不同方式的缺陷,优点总结

    1,四种解析Json的方式:Part 1 var list1 = [1,3,4]; alert(list1[1]); var list2 = [{"name":"leam ...

  8. 【HDOJ】1262 寻找素数对

    典型的二分决策树.而且本身两数和是偶数. #include <stdio.h> #include <string.h> #define MAXNUM 10001 int isP ...

  9. Service Oriented Architecture

    What is Service Oriented Architecture (SOA)? There have been so many interpretations of this through ...

  10. Oracle系列之包

    涉及到表的处理请参看原表结构与数据  Oracle建表插数据等等 建包 -- 建立包头 create package mypkg is procedure set_ctx(p_name in varc ...