题目链接

思路

求一个数列的前n项和(1/2, 1/3, ...., 1/n)大于所给数所需的项数。

#include<stdio.h>

int main()
{
float a;
while( scanf("%f",&a) )
{
if( a == 0.0 ) break;
int n=2;
float sum =0;
while( sum < a )
{
sum += 1.0/n;
n++;
}
printf("%d card(s)\n",n-2);
}
return 0;
}

百炼OJ - 1003 - Hangover的更多相关文章

  1. POJ.1003 Hangover ( 水 )

    POJ.1003 Hangover ( 水 ) 代码总览 #include <cstdio> #include <cstring> #include <algorithm ...

  2. OpenJudge / Poj 1003 Hangover

    链接地址: Poj:http://poj.org/problem?id=1003 OpenJudge:http://bailian.openjudge.cn/practice/1003 题目: Han ...

  3. 九度oj 1003

    前几天开刷九度oj,准备把做的题都放上,先放1003 题目1003:A+B             时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:16923 解决:7029 题目描述: 给 ...

  4. poj 1003:Hangover(水题,数学模拟)

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 99450   Accepted: 48213 Descri ...

  5. [POJ] #1003# Hangover : 浮点数运算

    一. 题目 Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 116593   Accepted: 56886 ...

  6. 快速切题 poj 1003 hangover 数学观察 难度:0

    Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 103896   Accepted: 50542 Descr ...

  7. 九度oj 1003 A+B 2010年浙江大学计算机及软件工程研究生机试真题

    题目1003:A+B 时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:12812 解决:5345 题目描述: 给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号",&qu ...

  8. 九度OJ 1003:A+B

    时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:15078 解决:6299 题目描述: 给定两个整数A和B,其表示形式是:从个位开始,每三位数用逗号","隔开. 现在请计 ...

  9. [POJ 1003] Hangover C++解题

        Hangover Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 95164   Accepted: 46128 De ...

随机推荐

  1. 设置display:inline-block 元素间隙

    上代码: <div class="page"> <a href="" class="num">共1231条</ ...

  2. AcWing 6. 多重背包问题 III

    //f[i,j] 所有只从前i块能量石中选,且总体积恰好为j的方案数 #include <iostream> #include <algorithm> #include < ...

  3. IDEA全局搜索

    搜索文件名:连续按两下Shift键 搜索字符串:Ctrl + Shift +F

  4. 剑指offer 39. 是否为平衡二叉树

    39. 是否为平衡二叉树 题目描述 输入一棵二叉树,判断该二叉树是否是平衡二叉树 任意结点的左右子树高度差不大于1就是平衡二叉树. C++解法 class Solution { public: boo ...

  5. MariaDB 安装配置记录

    1.集群搭建记录 iptables --append INPUT --protocol tcp \ --source 192.168.126.129 --jump ACCEPT iptables -- ...

  6. linux - mysql 异常:MySQL Daemon failed to start.

    报错内容 MySQL Daemon failed to start. 如果直接输入 mysql -root -p 登陆会出现 [mysql]ERROR 2002 (HY000): Can't conn ...

  7. 2、gitlab使用及权限管理

    目录 1.创建用户组... 2 2.创建用户... 4 3.新建项目... 5 4.linux端访问项目... 6 4.1 通过ssh方式访问... 6 4.2 通过http访问... 9 5.win ...

  8. HTML表单提交标签

    <form>表单提交标签,设置提交范围 有name属性才能被提交 action:提交的地址url method:提交方式 get方式(默认):会将参数拼接在连接后,有大小限制(4k) po ...

  9. 09 部署nginx web服务器(转发uwsgi请求)

    1 配置nginx转发 $ whereis nginx $ cd /usr/local/nginx/conf $ vi nginx.conf 注释掉原来的html请求,增加uwsgi请求. locat ...

  10. AcWing 1019. 庆功会 多重背包求max

    //多重背包 max #include <iostream> using namespace std; ; int n, m; int f[N]; int main() { cin > ...