HDU ACM 2740 Root of the Problem 简单数学题
来源:互联网 发布:畅想软件开发有限公司 编辑:程序博客网 时间:2024/06/12 00:09
题意:求A,使得A^N最接近B。
分析:A=B^(1/n),对其上下取整,在各取N次幂,取最接近B的。
#include<iostream>#include<cmath>using namespace std; int main() {int B,N,p,q;double tmp;while(cin>>B>>N && (B||N)){tmp=pow(1.0*B,1.0/N);p=floor(tmp); //向下取整q=ceil(tmp); //向上取整if(B-pow(p,N)>pow(q,N)-B)cout<<q<<endl;elsecout<<p<<endl;} return 0; }
0 0
- HDU ACM 2740 Root of the Problem 简单数学题
- hdu 2740 Root of the Problem (水)
- POJ 3100 && HDU 2740 Root of the Problem(水~)
- Root of the Problem
- HDU ACM 1071 The area [数学题]
- hdu 2058 The sum problem(数学题)
- hdu 2058 The sum problem(数学题)
- hdu 2058 The sum problem(数学题)
- POJ 3100 Root of the Problem(简单题)
- zoj2818 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
- HDU 1302 The Snail(简单数学题)
- HDU ACM 1010 Tempter of the Bone ->简单搜索
- hdu 2058 The sum problem 数学题,想了好久,,
- Java实现二叉排序(查找)树的操作
- Internal Sorting: Quicksort-2: Sorting by Exchanging
- 【操作系统总结】进程通信
- Nginx+uwsgi+Django 搭建一个简单的web服务器
- Arduino数字电路中的高低电平~~~
- HDU ACM 2740 Root of the Problem 简单数学题
- id ,NSObject, id<NSObject>区别
- 大量syn请求处理的一些问题
- ImageView的布局及高度设置
- 黑马程序员——IO的使用
- C#面试常见题目源代码汇总
- Lucene基础(二)--索引的操作
- centos ubuntu 配置ip dns
- ath9k中的EEPROM