首页 > 其他 > 详细

poj 1607(水题,物理,类似1003)

时间:2021-07-29 22:13:20      阅读:20      评论:0      收藏:0      [点我收藏+]
#include<iostream>
#include<cstdio>
using namespace std;
int main(){
    int data[100];
    double ans[100];
    int i=0;
    while(scanf("%d",&data[i])==1){
        ans[i] = 0;
        for(int j=1;j<=data[i];j++){
            ans[i] += 0.5/j;
        }
        i++;
    }
/*
Cards  Overhang 
1     0.500 
2     0.750 
3     0.917 
4     1.042 
30     1.997 
*/
    printf("Cards  Overhang\n");
    for(int j=0;j<i;j++){
        printf("%5d     %.3lf\n",data[j],ans[j]);
    }
    return 0;
}

 

poj 1607(水题,物理,类似1003)

原文:https://www.cnblogs.com/stevenzrx/p/15077104.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!