HDU 2139 Calculate the formula
http://acm.hdu.edu.cn/showproblem.php?pid=2139
代码:
#include <bits/stdc++.h>
using namespace std; const int maxn = 2345;
long long s[maxn]; int main() {
int N;
s[1] = 1;
for(int i = 3; i <= maxn; i += 2)
s[i] = s[i - 2] + i * i; while(~scanf("%d", &N)) {
printf("%lld\n", s[N]);
} return 0;
}
HDU 2139 Calculate the formula的更多相关文章
- HDOJ(HDU) 2139 Calculate the formula(水题,又一个用JavaAC不了的题目)
Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) 看到这个时间,我懵逼了... 果然,J ...
- Calculate the formula
Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2. Input ...
- HDU 2114 Calculate S(n)
http://acm.hdu.edu.cn/showproblem.php?pid=2114 Problem Description Calculate S(n). S(n)=13+23 +33 +. ...
- hdu 2114 Calculate S(n) 数论(简单题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2114 自己对数论一窍不通啊现在,做了一道水题,贴出来吧...主要是让自己记住这个公式: 前n项和的立方 ...
- HDU - 3347 Calculate the expression — 模拟 + map存变量
传送门 题意:从输入开始,1.输入样例数:2.然后输入一组样例中的行数n:3.前n-1行为定义变量(之间使用空格隔开),只需要map存进去就可以了(这里有覆盖的情况,故使用mp["s&quo ...
- hdu 6217 A BBP Formula 公式题
题意 已知公式:$\pi=\sum_{k=0}^{\infty}\left[\frac{1}{16^{k}}\left(\frac{4}{8 k+1}-\frac{2}{8 k+4}-\frac{1} ...
- 【HDU 2855】 Fibonacci Check-up (矩阵乘法)
Fibonacci Check-up Problem Description Every ALPC has his own alpc-number just like alpc12, alpc55, ...
- HDU 4342——History repeat itself——————【数学规律】
History repeat itself Time Limit: 1000ms Memory Limit: 32768KB This problem will be judged on HDU. O ...
- HDU 4342History repeat itself 数学
C - History repeat itself Time Limit:1000MS Memory Limit:32768KB Description Tom took the D ...
随机推荐
- 请对比 Exception 和 Error,另外,运行时异常与一般异常有什么区别?
error指的是不可预料的错误,可能会导致程序宕机:而exception指的是在程序运行中可以预见的异常,而异常分为检查异常与一般异常,检查异常需要在程序中显示捕获并处理,一般异常可以通过程序编码来进 ...
- springboot 集成kaptcha验证码Demo
验证码(CAPTCHA)是“Completely Automated Public Turing test to tell Computers and Humans Apart”(全自动区分计算机和人 ...
- jQuery获取data-*属性值
下面就详细介绍四种方法获取data-*属性的值 <li id="getId" data-id="122" data-vice-id="11&qu ...
- 百度知道芝麻将,申请资格&权限介绍&奖惩制度(简剖)
芝麻将,即百度知道管理员.不及掌握,了解下也是好的. 知道圈子,把注册用户,成为芝麻.一般用户,即小芝麻.芝麻将,就是咱们说的知道管理员. 申请. 芝麻将,申请条件不是很难,难的是后续维护,申请前考虑 ...
- Hadoop(13)-MapReduce框架原理--Job提交源码和切片源码解析
1.MapReduce的数据流 1) Input -> Mapper阶段 这一阶段的主要分工就是将文件切片和把文件转成K,V对 输入源是一个文件,经过InputFormat之后,到了Mapper ...
- JavaScript Shell学习分享
目录 JavaScript Shell学习分享 简介 安装 使用原因 小结 JavaScript Shell学习分享 简介 JavaScript Shell是由Mozilla提供的综合JavaScri ...
- python应用:爬虫实例(静态网页)
爬取起点中文网某本小说实例: # -*-coding:utf8-*- import requests import urllib import urllib2 from bs4 import Beau ...
- Python学习:变量
变量(Variables): 是为了存储程序在运算过程中的一些中间结果,为了方便日后调用储存在计算的内存中 官方介绍: Variables are used to storeinformation t ...
- C中 snprintf()函数的作用
函数原型:int snprintf(char* dest_str,size_t size,const char* format,...); 函数功能:先将可变参数 “…” 按照format的格式格式化 ...
- OVERLAY(文字の上書き)
OVERLAY 命令により.文字列が別の文字列によって上書きされます. OVERLAY c1 WITH c2 [ONLY str]. この命令により.項目 c1 のすべての位置のうち.str の中に出 ...