Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0

Problem Description
Given an integer n, we only want to know the sum of 1/k2 where k from 1 to n.
 

 

Input
There are multiple cases.
For each test case, there is a single line, containing a single positive integer n. 
The input file is at most 1M.
 



Output
The required sum, rounded to the fifth digits after the decimal point.
 



Sample Input
1
2
4
8
15
 



Sample Output
1.00000
1.25000
1.42361
1.52742
1.58044
 
n范围很大,需要用字符串读入
 #include <iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
using namespace std;
double a[];
char ch[];
int n;
int main()
{ for(int i=;i>=;i--)
a[i]=a[i+]+1.0/pow((double)i,2.0); while(~scanf("%s",&ch))
{
int len=strlen(ch);
int n=;
for(int i=;i<len;i++) {n=n*+ch[i]-''; if (n>) break;} if(n>=) printf("%.5lf\n",a[]);
else printf("%.5lf\n",a[]-a[n+]);
}
return ;
}

2016 ACM/ICPC Asia Regional Qingdao Online 1002 Cure的更多相关文章

  1. 2016 ACM/ICPC Asia Regional Qingdao Online 1001/HDU5878 打表二分

    I Count Two Three Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others ...

  2. HDU 5889 Barricade 【BFS+最小割 网络流】(2016 ACM/ICPC Asia Regional Qingdao Online)

    Barricade Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total S ...

  3. 2016 ACM/ICPC Asia Regional Qingdao Online(2016ACM青岛网络赛部分题解)

    2016 ACM/ICPC Asia Regional Qingdao Online(部分题解) 5878---I Count Two Three http://acm.hdu.edu.cn/show ...

  4. 2016 ACM/ICPC Asia Regional Dalian Online 1002/HDU 5869

    Different GCD Subarray Query Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K ( ...

  5. 2016 ACM/ICPC Asia Regional Qingdao Online

    吐槽: 群O的不是很舒服 不知道自己应该干嘛 怎样才能在团队中充分发挥自己价值 一点都不想写题 理想中的情况是想题丢给别人写 但明显滞后 一道题拖沓很久 中途出岔子又返回来搞 最放心的是微软微软妹可以 ...

  6. 【2016 ACM/ICPC Asia Regional Qingdao Online】

    [ HDU 5878 ] I Count Two Three 考虑极端,1e9就是2的30次方,3的17次方,5的12次方,7的10次方. 而且,不超过1e9的乘积不过5000多个,于是预处理出来,然 ...

  7. hdu 5878 I Count Two Three (2016 ACM/ICPC Asia Regional Qingdao Online 1001)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5878 题目大意: 给出一个数n ,求一个数X, X>=n. X 满足一个条件 X= 2^a*3^ ...

  8. Hdu OJ 5884-Sort (2016 ACM/ICPC Asia Regional Qingdao Online)(二分+优化哈夫曼)

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5884 题目大意:有n个有序的序列,对于第i个序列有ai个元素. 现在有一个程序每次能够归并k个序列, ...

  9. 2016 ACM/ICPC Asia Regional Qingdao Online HDU5889

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=5889 解法:http://blog.csdn.net/u013532224/article/details ...

随机推荐

  1. CF:Problem 427C - Checkposts良好的沟通 Tarjan算法

    tarjan算法的第一个问题 喷我的脸....手写叠式开成BOOL,我一直在找错了... #include<cstdio> #include<cstring> #include ...

  2. 读书笔记—CLR via C#线程27章节

    前言 这本书这几年零零散散读过两三遍了,作为经典书籍,应该重复读反复读,既然我现在开始写博了,我也准备把以前觉得经典的好书重读细读一遍,并且将笔记整理到博客中,好记性不如烂笔头,同时也在写的过程中也可 ...

  3. 自己动手实现Expression翻译器 – Part Ⅱ

    上一节我们了解了Linq查询大体上是如何运转的,并针对SQL表达式进行建模(DbExpression),这一节的重点在于如何将表达式转换为DbExpression. 可以说只要能生成结构清晰的DbEx ...

  4. APNs功能之Node.js和Mysql应用总结

    APNs功能之Node.js和Mysql应用总结 这篇文档主要是总结Node.js和Mysql的学习心得体会.当然也可以看作是此前所写的消息推送服务的续篇. 简单描述下应用背景,我们的应用需要实现苹果 ...

  5. tortoiseSVN 设置ignore

      *.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store *.dll ...

  6. DES加密解密帮助类

    public class DESCrypto { /// <summary> /// 初始化des实例秘钥及向量 /// </summary> /// <param na ...

  7. require.js实践

    ASP.NET MVC应用require.js实践 这里有更好的阅读体验和及时的更新:http://pchou.info/javascript/asp.net/2013/11/10/527f6ec41 ...

  8. 常用oracle语句-------------------------------------------》(笔记)

      Orale常用语句 1:查询指定表名的字段 select * from sys.user_tab_columns where table_name=表名 //查询指定表名的字段 2: 查询数据库参 ...

  9. .NET4.5 Console.ReadKey()在多线程下的BUG

    .NET 4.5 在多线程的控制台里,Console.ReadKey()可能会造成线程死锁.看代码: static void Main(string[] args) { System.Timers.T ...

  10. ASP.NET Web API下的HttpController激活:程序集的解析

    ASP.NET Web API下的HttpController激活:程序集的解析 HttpController的激活是由处于消息处理管道尾端的HttpRoutingDispatcher来完成的,具体来 ...