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. Python的库和资源(转)

    Python的库和资源: http://blog.sina.com.cn/s/blog_3cb6a78c0100hpaq.html Python 常用模块: http://www.pythonclub ...

  2. 再写FFT模板

    没什么好说的,今天又考了FFT(虽然不用FFT也能过)但是确实有忘了怎么写FFT了,于是乎只有重新写一遍FFT模板练一下手了.第一部分普通FFT,第二部分数论FFT,记一下模数2^23*7*17+1 ...

  3. 使用php实现权限管理模块

    在说权限管理模块前,应该先知道权限管理模块要有哪些功能: 1.用户只能访问,指定的控制器,指定的方法 2.用户可以存在于多个用户组里 3.用户组可以选择,指定的控制器,指定的方法   4.后台可以添加 ...

  4. delphi中formatFloat代码初探(在qt下实现floatformat的函数)

    由于项目需要,需要在qt下实现floatformat的函数.之前写过一个,但是写得不好.决定重新写一个,参考delphi xe2下的实现.把xe2下的相关代码都看了一遍,xe2的代码思路在这里贴出来. ...

  5. HDU 4288 Coder 【线段树+离线处理+离散化】

    题意略. 离线处理,离散化.然后就是简单的线段树了.需要根据mod 5的值来维护.具体看代码了. /* 线段树+离散化+离线处理 */ #include <cstdio> #include ...

  6. gcc编译常用选项

    我的博客:www.while0.com GDB调试: -g 生成的可执行文件才可以用gdb调试 (建议在发行版中用strip filename 来把这些调试信息去除) 开始调试. 以下是基础调试命令: ...

  7. Html——footer的使用

    html部分 <div class="container"> <div class="body"></div> <di ...

  8. WordPress Pretty Photo插件‘hashrel’参数跨站脚本漏洞

    漏洞名称: WordPress Pretty Photo插件‘hashrel’参数跨站脚本漏洞 CNNVD编号: CNNVD-201311-405 发布时间: 2013-11-28 更新时间: 201 ...

  9. [swustoj 443] Handsome Swap

    Handsome Swap(0443) Time limit(ms): 1000 Memory limit(kb): 65535 Submission: 89 Accepted: 20 Accepte ...

  10. 如何使用eclipse进行嵌入式Linux的开发

    如何使用eclipse进行嵌入式Linux的开发 作者:曾宏安,华清远见嵌入式学院高级讲师. 如何使用eclipse进行嵌入式Linux的开发 习惯了在windows环境下开发的程序员在转到Linux ...