poj 3100 && zoj 2818 ( Root of the Problem ) (睡前一水)
来源:互联网 发布:淘宝怎么让人代付 编辑:程序博客网 时间:2024/04/28 22:02
链接:click here
题意:
Given positive integers B and N, find an integer A such that AN is as close as possible to B. (The result A is an approximation to the Nth root of B.) Note that AN may be less than, equal to, or greater than B.
.给你B和N,求个整数A使得A^n最接近B
不解释,代码:
//zoj 2818 poj 3100#include <stdio.h>#include <stdlib.h>#include <iostream>#include <string.h>#include <math.h>using namespace std;int main(){ double b,n; while(cin>>b>>n&&b&&n) { int a=(int )pow(b,1/n); //cout<<pow(a,n)<<endl; if(b-pow(a,n)<pow(a+1,n)-b) cout<<a<<endl; else cout<<a+1<<endl; } return 0;}
0 0
- poj 3100 && zoj 2818 ( Root of the Problem ) (睡前一水)
- zoj 2818 || poj 3100 Root of the Problem(水! = =)
- POJ 3100 & ZOJ 2818 & HDU 2740 Root of the Problem(数学)
- zoj 2818 Root of the Problem
- ZOJ Problem Set - 2818 Root of the Problem
- POJ 3100 Root of the Problem
- poj 3100 Root of the Problem
- POJ 3100 Root of the Problem (水题)
- POJ 3100:Root of the Problem
- POJ 3100 Root of the Problem G++
- POJ 3100 Root of the Problem 可能会
- POJ 3100 Root of the Problem(简单题)
- POJ 3100 && HDU 2740 Root of the Problem(水~)
- POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!
- Poj.3100 Root of the Problem【水】 2015/09/22
- POJ-3100-Root of the Problem,原来是水题,暴力求解~~~
- Root of the Problem-3100
- ZOJ.2818 Root of the Problem【开根号,水】 2015/09/22
- 数据泵
- Java笔记七.线程间通信与线程生命的控制
- 快速掌握一个语言最常用的50%
- Nmap 空闲扫描
- oracle基本语法
- poj 3100 && zoj 2818 ( Root of the Problem ) (睡前一水)
- C++强大背后
- boost::asio::io_service(之一)
- 解决sql中上下左右backspace不能用的方法
- C语言中的位操作
- ZOJ Problem Set - 2723 Semi-Prime(ac,但有一点想不通)
- 僵尸进程的产生原因和避免方法
- ultraiso软碟通 v9.6.2.3059注册码
- 57段让编译器崩溃的C语言代码