HDU 1008 u Calculate e】的更多相关文章

Problem Description A simple mathematical formula for e is where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.   Output Output the approximations of e generated by the ab…
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 Problem Description A simple mathematical formula for e is where n is allowed to go to infini…
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1012 u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 52607    Accepted Submission(s): 24106 Problem Description A simple mathematical…
u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 28686    Accepted Submission(s): 12762 Problem Description A simple mathematical formula for e is where n is allowed to go to infini…
题意: 电梯当前在0层,每在1层需要停5秒,往上走每层需6秒,往下走每层需要4秒. 思路: 在接收输入的时候直接计算了它,不用再弄一个循环.每计算一个请求就更新当前层,停留5秒的等到输出时再加上5*n就行了.这样老实计算就不需要考虑特殊情况了,比如第一个请求是在0层,是不是得停5秒先? #include <iostream> using namespace std; void main() { ,ans=,s=,i,a; while(scanf("%d",&n)&a…
#include<iostream> using namespace std; int main() { int n; ]; while(cin>>n) { ,m=; ) break; ;i<n;i++) { cin>>a[i]; if(a[i]>m) { t+=(a[i]-m)*; } else if(a[i]<m) { t+=(m-a[i])*; } m=a[i]; t=t+; // 因为同层时要停留 所以t+=5不能放到if里面去 } cout&…
Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will s…
题目意思是:给你N个数字  每个数字表示多少层楼  现在要你从0层楼开始坐电梯  一次按顺序走过这些楼层 规则是 上楼6秒 ,下楼4秒,每次到达一个楼层停5秒..... 思路:模拟 代码如下:(要注意的是 如果电梯没动 也就是temp==0,这也是一种情况.....被坑了..) #include <iostream> #include <stdio.h> #include <string.h> using namespace std; int main() { ]; w…
Elevator其实是一道水题,思路也很简单,但不知道怎么也不能AC,后来看了别人的再比较自己的以后找到错误. 在判断奇偶数之后的语句时,我用了if()  else if(),这是不能AC的原因,这种条件判断的话,会忽略连续输入两个相等数的情况. #include <iostream> using namespace std; int e[105]; int main() { int n; while(cin>>n&&n!=0) { int time_0 = 0;…
题解:直接模拟 #include <cstdio> int main(){ puts("n e");puts("- -----------");puts("0 1"); double ans=1.0,f=1.0; for(int i=1;i<=9;i++){ if(i==1)printf("%d %.0lf\n",i,(ans+=(f/=(double)i))); else if(i==2)printf(&q…