FOJ Problem 1077 铁皮容器
来源:互联网 发布:热敏打印机软件推荐 编辑:程序博客网 时间:2024/06/11 04:39
Problem Description
使用白铁皮制作圆柱容器(有盖),其中每个容器耗用的铁皮量(表面积)固定为1000平方厘米。在已知容器的容积情况下,编程计算容器底半径的最小可能取值。其中容器的容积为整数,半径精确到小数点后面一位。
Input
输入的第一行含一个正整数k (1<=k<=10),表示测试例的个数。后面紧接着k行,每行对应一个测试例,含一个整数n(0<=n<=20000),代表容积。
Output
每个测试例对应一行输出,含一个实数,表示半径的值,若无解则输出“NO”。
Sample Input
2
1000
3000
Sample Output
2.1
使用白铁皮制作圆柱容器(有盖),其中每个容器耗用的铁皮量(表面积)固定为1000平方厘米。在已知容器的容积情况下,编程计算容器底半径的最小可能取值。其中容器的容积为整数,半径精确到小数点后面一位。
Input
输入的第一行含一个正整数k (1<=k<=10),表示测试例的个数。后面紧接着k行,每行对应一个测试例,含一个整数n(0<=n<=20000),代表容积。
Output
每个测试例对应一行输出,含一个实数,表示半径的值,若无解则输出“NO”。
Sample Input
2
1000
3000
Sample Output
2.1
NO
//这题给我们的启示是精确到一位的时候要计算到两位 //枚举就好了 # include "stdio.h" # define pi 3.1415926535898int main(){double r;double v;int i, t;int flage;double min, num, ans;scanf("%d", &t);for(i=1; i<=t; i++){scanf("%lf", &v);min=0.0;flage=1;for(r=0.01; ; r=r+0.01){ if(pi*r*r>500)break;if(v/r+pi*r*r<=500){printf("%.1lf\n", r);flage=0;break;}}if(flage)printf("NO\n");}return 0;}
0 0
- FOJ Problem 1077 铁皮容器
- FZU 1077 铁皮容器
- 铁皮容器
- I-铁皮容器
- FOJ 1692 Key problem
- FOJ Problem 1099 Square
- FOJ-2214 Knapsack problem
- FOJ Problem 2221 RunningMan
- FOJ Problem 2214 Knapsack problem
- FOJ 1350 Very Simple Problem
- foj 1971 A math problem
- Foj 2164 Jason's problem
- 【FOJ 1350】 Very Simple Problem
- foj 1350 Very Simple Problem
- FOJ Problem 1004 Number Triangle
- FOJ Problem 1011 Power Strings
- FOJ Problem 1062 洗牌问题
- FOJ Problem 1081 等分液体
- 2015-2016 ACM ICPC Baltic Selection Contest C Minimax Tree
- fac()阶乘函数的写法
- 推荐给大家减压神曲 -- 电音神曲
- Elasticsearch学习笔记(2)
- Linux下ifconfig的简易实现
- FOJ Problem 1077 铁皮容器
- Git 使用规范流程
- IOS火星坐标转换
- hdoj 2190 悼念512汶川大地震遇难同胞——重建希望小学
- 相对路径 和 绝对路径
- display:inline、block、inline-block的区别
- 有些开发经验的程序员去学android (一)
- 【LeetCode OJ 263】Ugly Number
- Java IO流(2)