1517 u Calculate e
1. 最前面的格式要记得输入.
2. 计算的时候要从3开始重新计算, 否则会丢失精度.
3. 更快的方式就是打表.
#include <iostream>
using namespace std; // 5 120
// 6 720
// 7 5040
// 8 40320
// 9 362880 int main(){
cout<<"n e"<<endl;
cout<<"- -----------"<<endl;
double ans[] = {,,2.5,,,,,,,};
for(int i=;i<;++i){
cout<<i<<" "<<ans[i]<<endl;
}
cout.precision();
for(int i=;i<;++i){
ans[i] = ans[i-] + (double)1.0/ans[i];
cout<<i<<" "<<ans[i]<<endl;
} return ;
}
-->
1517 u Calculate e的更多相关文章
- poj 1517 u Calculate e
u Calculate e Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19465 Accepted: 11362 ...
- OpenJudge/Poj 1517 u Calculate e
1.链接地址: http://bailian.openjudge.cn/practice/1517 http://poj.org/problem?id=1517 2.题目: 总时间限制: 1000ms ...
- poj 1517 u Calculate e(精度控制+水题)
一.Description A simple mathematical formula for e is e=Σ0<=i<=n1/i! where n is allowed to go t ...
- 算法之路 level 01 problem set
2992.357000 1000 A+B Problem1214.840000 1002 487-32791070.603000 1004 Financial Management880.192000 ...
- 【转】POJ百道水题列表
以下是poj百道水题,新手可以考虑从这里刷起 搜索1002 Fire Net1004 Anagrams by Stack1005 Jugs1008 Gnome Tetravex1091 Knight ...
- 【HDU】1517 A Multiplication Game
http://acm.hdu.edu.cn/showproblem.php?pid=1517 题意:每次乘上2~9..p>=n时赢.. #include <cstdio> #incl ...
- [转] PHP计算两个坐标之间的距离, Calculate the Distance Between Two Points in PHP
Calculate the Distance Between Two Points in PHP There are a lot of applications where it is useful ...
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin ...
- maven -- 问题解决(二)解决“Could not calculate build plan”问题
错误提示如下:(eclipse+maven) Could not calculate build plan: Failure to transfer org.apache.maven.plugins: ...
随机推荐
- cordova 安装使用
前人总结: Cordova是Apache软件基金会的一个产品.其前身是PhoneGap,由Nitobi开发,2011年10月,Adobe收够了Nitobi,并且PhoneGap项目也被贡献给Apach ...
- 遍历并批量删除容器中元素出现ConcurrentModificationException原因及处置
在以下四种遍历过程中,前两种会抛出ConcurrentModificationException,而后两种方法是正确的. Department类: package com.sitinspring; i ...
- jquery.easyui.tabs 中的首个tabs被最后tabs覆盖的问题解决方法
这是由于tabs对href重载的的问题导致,因此我们需要将href更改为其它自定义的属性即可避免此问题的发生. 解决方法如下: 第一步页面端: 循环体开始 <li> <div> ...
- View.findViewById()和Activity.findViewById()区别
在网上看见View.findViewById() 和 Activity.findViewById()执行效率不一样 使用Activity.findViewById()如: TextView tv_in ...
- 04——wepy框架搭建
wepy官方文档:https://tencent.github.io/wepy/document.html#/ 1.项目下载 # .安装wepy-cli npm install wepy-cli -g ...
- XML---Studying
XML 被设计用来传输和存储数据. HTML 被设计用来显示数据. 1.什么是 XML? XML 指可扩展标记语言(EXtensible Markup Language) XML 是一种标记语言,很类 ...
- Java Servlet调用数据库复习
首先要导入jar包. 剩下的基本就是模版式的代码了: public class main { // JDBC 驱动名及数据库 URL static final String JDBC_DRIVER = ...
- C#模板的效率问题
1,有拆装箱的情景时,可使用模板方式避免拆装箱,这时候使用模板比不使用效率要高很多. 2,无拆装箱的操作时,全部是值传递,使用模板会比使用基本类型慢一半
- postman的使用方法详解
Collections:在Postman中,Collection类似文件夹,可以把同一个项目的请求放在一个Collection里方便管理和分享,Collection里面也可以再建文件夹.如果做API文 ...
- elasticsearch中的mapping简介
默认mapping elasticsearch(以下简称ES)是没有模式(schema)的,当我们执行以下命令: curl -d '{"name":"zach" ...