HDU 1012 u Calculate e【暴力打表,水】
u Calculate e
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 46844 Accepted Submission(s): 21489

where
n is allowed to go to infinity. This can actually yield very accurate
approximations of e using relatively small values of n.
the approximations of e generated by the above formula for the values
of n from 0 to 9. The beginning of your output should appear similar to
that shown below.
#include <bits/stdc++.h>
using namespace std;
inline double gcd(int n)
{
int sum=;
for(int i=;i<=n;i++)
sum*=i;
return sum;
}
int main()
{
cout<<'n'<<" "<<'e'<<endl;
cout<<"- -----------"<<endl;
cout<<<<" "<<<<endl;
cout<<<<" "<<<<endl;
cout<<<<" "<<2.5<<endl;
double sum=2.5;
for(int i=;i<=;i++)
{
sum+=(1.0/(double)gcd(i));
printf("%d %.9lf\n",i,sum);
}
return ;
}
HDU 1012 u Calculate e【暴力打表,水】的更多相关文章
- hdu 1012:u Calculate e(数学题,水题)
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- HDU 1012 u Calculate e(简单阶乘计算)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1012 u Calculate e Time Limit: 2000/1000 MS (Java/Oth ...
- HDU 1216 Assistance Required(暴力打表)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1216 Assistance Required Time Limit: 2000/1000 MS (Ja ...
- HDU 5648 DZY Loves Math 暴力打表
题意:BC 76 div1 1003有中文题面 然后官方题解看不懂,我就不说了,然后看别人的题解 因为询问i,j最大都是15000,所以可以预处理,res[i][j]代表答案,然后显然这是开不下的,也 ...
- HDU 1012 u Calculate e
题解:直接模拟 #include <cstdio> int main(){ puts("n e");puts("- -----------");pu ...
- 暴力打表之hdu 2089
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2089 有两种方法: 1.数位DP算法 2.暴力打表——真是个好法子!!! 接下来是注意点: 1.一般这 ...
- HDU 5179 beautiful number (数位dp / 暴力打表 / dfs)
beautiful number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- hdu 1431 素数回文(暴力打表,埃托色尼筛法)
这题开始想时,感觉给的范围5 <= a < b <= 100,000,000太大,开数组肯定爆内存,而且100000000也不敢循环,不超时你打我,反正我是不敢循环. 这题肯定得打表 ...
- ACM/ICPC 之 暴力打表(求解欧拉回路)-编码(POJ1780)
///找到一个数字序列包含所有n位数(连续)一次且仅一次 ///暴力打表 ///Time:141Ms Memory:2260K #include<iostream> #include< ...
随机推荐
- 前端开发必备之MDN文档
想下载MDN文档的看前面的内容就可以了. HTML 源码下载 MDN官方下载地址:https://developer.mozilla.org/media/developer.mozilla.org.t ...
- GAME——转圈游戏
我们在生命的路上常常绝望 大概是因为弯路走了太多 脚上的泡被磨起又磨破 像我们所有的幻想与梦 起起落落. 所以说 我这道题考场上面和题解想得一模一样啊啊啊啊啊啊啊啊啊啊!!!!!! 但是就是打复杂了啊 ...
- bzoj 4872: [Shoi2017]分手是祝愿
Description Zeit und Raum trennen dich und mich. 时空将你我分开.B 君在玩一个游戏,这个游戏由 n 个灯和 n 个开关组成,给定这 n 个灯的初始状态 ...
- bzoj 2109: [Noi2010]Plane 航空管制
Description 世博期间,上海的航空客运量大大超过了平时,随之而来的航空管制也频频 发生.最近,小X就因为航空管制,连续两次在机场被延误超过了两小时.对此, 小X表示很不满意. 在这次来烟台的 ...
- su和sudo命令的区别
一. 使用 su 命令临时切换用户身份 参考 1.su 的适用条件和威力 su命令就是切换用户的工具,怎么理解呢?比如我们以普通用户beinan登录的,但要添加用户任务,执行useradd ,bein ...
- SQL语句 我喜欢上海
select * from [user] wherer name like '上海%'
- Spring Error : No unique bean of type [org.apache.ibatis.session.SqlSessionFactory] is defined
报错信息: Injection of autowired dependencies failed; nested exception is org.springframework.beans.fa ...
- 妙味课堂:JavaScript初级--第11课:字符串、查找高亮显示
1.数字字母 Unicode 编码 <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content- ...
- 阿里云ECS搭建SVN配置外网
阿里云ECS搭建SVN后,配置外网启动不了,检查云服务器没发现问题,后来发现是阿里云拦截,需要在阿里云控制台ECS安全组新增如下配置:
- SQL SERVER 日期转换大全
博客转自:http://blog.csdn.net/baiduandxunlei/article/details/9180075 CONVERT(data_type,expression[,style ...