hdu2011
http://acm.hdu.edu.cn/showproblem.php?pid=2011
#include<iostream>
#include<math.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
using namespace std; int main()
{
int m;
cin>>m;
while(m--)
{
int n;
cin >>n;
double sum=;
for(int i=;i<=n;i++)
{
if(i%!=)
{
sum+=*1.0/i;
}
else
sum-=*1.0/i;
}
printf("%.2lf\n",sum);
}
return ;
}
hdu2011的更多相关文章
- 多项式求和,素数判定 HDU2011.2012
HDU 2011:多项式求和 Description 多项式的描述如下: 1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 + ... 现在请你求出该多项式的前n项的和. Input ...
- HDU--2011
多项式求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Subm ...
- hdu2011 多项式求和【C++】
多项式求和 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submi ...
- OJ题目分类
POJ题目分类 | POJ题目分类 | HDU题目分类 | ZOJ题目分类 | SOJ题目分类 | HOJ题目分类 | FOJ题目分类 | 模拟题: POJ1006 POJ1008 POJ1013 P ...
- HDU100题简要题解(2010~2019)
HDU2010 水仙花数 题目链接 Problem Description 春天是鲜花的季节,水仙花就是其中最迷人的代表,数学上有个水仙花数,他是这样定义的: "水仙花数"是指一个 ...
随机推荐
- centos6.5安装fpm打包工具
FPM功能简单说就是将一种类型的包转换成另一种类型.FPM的github:https://github.com/jordansissel/fpm 1.支持的源类型包: dir: 将目录打包成所需要的类 ...
- PCB参数计算神器-Saturn PCB Design Toolkit下载及安装指南
进行PCB设计,特别是高频高速设计时,难免会涉及到PCB相关参数的计算及设置,如:VIA的过流能力,VIA的寄生电容.阻抗等,导线的载流能力,两相互耦合信号线间的串扰,波长等参数. 这里向大家介绍一款 ...
- arm汇编指令总结(不断更新)
/** ****************************************************************************** * @author Maox ...
- Ubuntu14.04 安装 PHP cURL
今天遇到 Fatal error: Call to undefined function curl_init() in /xxx/xxxx/www/application/library/Ku/Htt ...
- Webserver issues | PHP manager for IIS
4 down vote accepted In order to successfully install the PHP manager for IIS 8, you need the .NET 3 ...
- Linux之父Linus Torvalds:讨厌C++
"Linux内核的创始人Linus Torvalds最近在一封邮件中说明了内核开发需要使用C语言而非C++的理由.在庞大的项目中,人们对不是自己开发的模块并不了解,能快速理解其他模块中函数的 ...
- 1094. The Largest Generation (25)
A family hierarchy is usually presented by a pedigree tree where all the nodes on the same level bel ...
- 1049. Counting Ones/整数中1出现的次数(从1到n整数中1出现的次数)
The task is simple: given any positive integer N, you are supposed to count the total number of 1's ...
- java实现合并两个已经排序的列表
相对于C++来说,Java的最大特点之一就是没有令人困惑的指针,但是我们不可否认,在某些特定的情境下,指针确实算的上一把利刃.虽然Java中没有明确定义出指针,但是由于类的思想,我们可以使用class ...
- centos 6.4 apache开启gzip方法
系统概况,主机CentOS6.4 Apache2.4 php5.3.6 mysql5.5 开始:首先得确认apache是否已经加载了mod_deflate模块 1.httpd -M 在结果中查看是否 ...