poj1003
来源:互联网 发布:巨星知我心 by凌豹姿 编辑:程序博客网 时间:2024/06/10 02:07
WA
#include<iostream>#include<cstdio>using namespace std;int main() { float n; float length = 0; cin>>n; if (n == 0.0){ return 0; } int i; for(i = 1; length < n; i++){ length += 1.0/(i + 1); } printf("%d card(s)\n", i-1); return 0;}
AC
#include<iostream>#include<cstdio>using namespace std;int main() { float n; int i; float length; while(scanf("%f", &n) == 1){ if (n == 0.0){ return 0; } length = 0; for(i = 1; length < n; i++){ length += 1.0/(i + 1); } printf("%d card(s)\n", i - 1); } return 0;}
0 0
- POJ1003
- POJ1003
- poj1003
- poj1003
- poj1003
- POJ1003
- POJ1003
- poj1003
- POJ1003
- poj1003
- POJ1003
- Poj1003
- poj1003
- poj1003
- poj1003
- POJ1003
- poj1003
- poj1003
- 文章标题
- HDU 5904 BestCoder Round #88 Find Q (统计Q!)
- 折线分割平面
- 2.长川科技
- 11gRAC搭建单机Dataguard
- poj1003
- @media:device-width、orientation
- 我的联系方式
- 关于广播接收者与服务
- PHP ajax传值给后台
- [leetcode]11. Container With Most Water
- 工具 | Tmux 命令备忘
- 博客旅程之始
- 【并行计算-CUDA开发】#pragma unroll伪编译指令的使用