这题有毒。要用long double定义,以及cout控制格式输出。

#include<cstdio>
#include<cstring>
#include<cmath>
#include <iomanip>
#include<iostream>
#include<algorithm>
using namespace std; long double f(int a)
{
long double sum=;
for(int i=;i<=a;i++) sum=sum+(long double)1.0/i;
return sum;
} int main()
{ int n;
while(~scanf("%d",&n))
{
cout << fixed <<setprecision() << f(n) << endl;
}
return ;
}

FZU 1058 粗心的物理学家的更多相关文章

  1. FOJ-1058-粗心的物理学家

    题目:粗心的物理学家 代码: #include<stdlib.h> #include<iostream> #include<cstdio> using namesp ...

  2. NYOJ之题目1058部分和问题

    ---------------------------------------- 简单搜索+剪枝 因为考虑到可能会有多个解,所以是将中间过程保存最后才一起打印出来的 AC代码: 1: 2: impor ...

  3. FZU 2137 奇异字符串 后缀树组+RMQ

    题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...

  4. FZU 1914 单调队列

    题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...

  5. ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】

     FZU 2105  Digits Count Time Limit:10000MS     Memory Limit:262144KB     64bit IO Format:%I64d & ...

  6. FZU 2112 并查集、欧拉通路

    原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...

  7. ACM: FZU 2107 Hua Rong Dao - DFS - 暴力

    FZU 2107 Hua Rong Dao Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I6 ...

  8. ACM: FZU 2112 Tickets - 欧拉回路 - 并查集

     FZU 2112 Tickets Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u P ...

  9. ACM: FZU 2102 Solve equation - 手速题

     FZU 2102   Solve equation Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

随机推荐

  1. 设置SVN,Git忽略MAC的.DS_Store文件的方法

    设置SVN,Git忽略MAC的.DS_Store文件的方法 I. 显示Mac隐藏文件的命令: defaults write com.apple.finder AppleShowAllFiles -bo ...

  2. HTML5程序设计 Canvas API

    检测浏览器支持情况 <script type="text/javascript"> try { document.createElement("Canvas& ...

  3. hdu1501 Zipper

    Zipper Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submis ...

  4. CodeForces 701C They Are Everywhere(map的应用)

    这个题比较好的解决办法,我觉得还是map,map的size可以很快的知道我们选了几个字母,而且可以作为计数器,知道每一个字母出现了多少次, erase函数可以清除掉一个元素. 所以,定义两个指针L和R ...

  5. Node.js学习 - Event Loop

    Node.js本身是单线程,但通过事件和回调支持并发,所以性能非常高. Node.js的每一个API都是异步的,并作为一个独立线程运行,使用异步函数调用,并处理并发. 事件驱动程序 实例 var ev ...

  6. Python 数据挖掘 工具包整理

    连接器与io 数据库 类别 Python R MySQL mysql-connector-python(官方) RMySQL Oracle cx_Oracle ROracle MongoDB pymo ...

  7. 修改document.domain的注意事项(转)

    有时候,需要修改document.domain. 典型的情形:http://a.xxx.com/A.htm 的主页面有一个<iframe src="http://b.xxx.com/B ...

  8. Centos yum 安装mysql报错 No package mysql-server available.

    这是因为大多数mysql-*的资源名称被mariadb-*重命名了 所以换成 yum install mariadb-server 就可以了 PS[摘自网络] MariaDB不仅仅是Mysql的一个替 ...

  9. Sonya and Problem Wihtout a Legend

    Sonya and Problem Wihtout a Legend Sonya was unable to think of a story for this problem, so here co ...

  10. uboot1.1.6之NOR FLASH 出现的问题解决方法

    U-BOOT移植,structure has no member named `CAMDIVN speed.c: In function `get_HCLK':speed.c:114: error: ...