zoj 2818 || poj 3100 Root of the Problem(水! = =)
2010-11-25 23:15
435 查看
如今 找水题也是门技术。。。
给你B N 求出 最接近B的N次方根的整数。。。
给你B N 求出 最接近B的N次方根的整数。。。
#include <stdio.h> #include <stdlib.h> #include <iostream> #include <string.h> #include <math.h> using namespace std; int main(void) { double b,n,temp; while( cin >> b >> n && b && n ) { temp = pow(b,1/n); int x = (int)temp; int y = (int)(temp+0.5); if( b - pow(x,n) > pow(y,n) - b ) cout << y << endl; else cout << x << endl; } return 0; }
相关文章推荐
- poj 3100 && zoj 2818 ( Root of the Problem ) (睡前一水)
- POJ 3100 & ZOJ 2818 & HDU 2740 Root of the Problem(数学)
- POJ 3100 & ZOJ 2818 & HDU 2740 Root of the Problem(数学)
- 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 (水题)
- POJ_3100_Root of the Problem(暴力)
- zoj 2818 Root of the Problem
- a的n次幂 —— POJ 3100 Root of the Problem
- zoj2818 Root of the Problem 简单数学 开方
- zoj 2818 Root of the Problem(数学思维题)
- POJ 3100 Root of the Problem G++
- POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!
- poj 3100 Root of the Problem
- POJ 3100 Root of the Problem || 1004 Financial Management 洪水!!!
- POJ 3100 Root of the Problem(我的水题之路——取A^N最接近B的A)
- POJ 3100:Root of the Problem
- zoj 2818 Root of the Problem
- POJ-3100-Root of the Problem,原来是水题,暴力求解~~~