hdu 2740 Root of the Problem (水)
来源:互联网 发布:linux内存管理 编辑:程序博客网 时间:2024/06/05 16:07
点击打开链接
题目意思很简单,给你一个b和一个n,找到一个a使a^n最接近b
先求出a=b^(1/n),然后再它附近找,
#include<stdio.h>#include<math.h>void main(){float B,N,A1,A2,A3,A;scanf("%f%f",&B,&N);while(B!=0&&N!=0){A1=pow(B,1/N);A2=1.0+(int)A1;A3=(int)A1-1.0;A1=(int)A1*1.0;A=fabs(pow(A1,N)-B)>fabs(pow(A2,N)-B )?A2:A1;A=fabs(pow(A,N)-B)>fabs(pow(A3,N)-B )?A3:A;printf("%d\n",(int)A) ;scanf("%f%f",&B,&N);}}
- hdu 2740 Root of the Problem (水)
- POJ 3100 && HDU 2740 Root of the Problem(水~)
- HDU ACM 2740 Root of the Problem 简单数学题
- Root of the Problem
- POJ 3100 & ZOJ 2818 & HDU 2740 Root of the Problem(数学)
- 1394. Root of the Problem
- TJU Root of the Problem
- Root of the Problem-3100
- 1394. Root of the Problem
- Poj.3100 Root of the Problem【水】 2015/09/22
- POJ 3100 Root of the Problem(简单题)
- poj 3100 && zoj 2818 ( Root of the Problem ) (睡前一水)
- zoj 2818 || poj 3100 Root of the Problem(水! = =)
- POJ 3100 Root of the Problem
- sicily 1394 Root of the Problem
- zoj 2818 Root of the Problem
- Sicily 1394. Root of the Problem
- poj 3100 Root of the Problem
- UVa 10382 - Watering Grass
- firefox伪造请求头信息,模拟手机访问网站
- 求解:ASP.NET中的添加引用到底是一个什么样的事情
- hdu 2560 Buildings (水)
- BIEE建模技术之-时间事实表
- hdu 2740 Root of the Problem (水)
- UVa 11054 - Wine trading in Gergovia
- CMD命令之BAT脚本语法详解
- hdu 2521 反素数 (水)
- postgresql 插入字符串有空格,见图片
- UVa 10718 - Bit Mask
- java.text.Collator 类的具体使用方法
- 【线段树】 hdu4325 Flowers
- hdu2734 Quicksum (水)