nyoj 773-开方数 (pow)

773-开方数


内存限制:64MB 时间限制:1000ms 特判: No
通过数:3 提交数:8 难度:3

题目描述:

现在给你两个数 n 和 p ,让你求出 p 的开 n 次方。

输入描述:

每组数据包含两个数n和p。当n和p都为0时表示输入结束。(1<=n<=200,1<=p<=10^101)

输出描述:

对于每个输出对用输出开方后的结果k(结果小于10^9)。

样例输入:

复制
2 16
3 27
7 4357186184021382204544
0 0

样例输出:

4
3
1234

C/C++:

#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#include <queue>
#include <climits>
#include <bitset>
#define PI 3.1415926

using namespace std;
const int MY_MAX = 10005;
int N, A[MY_MAX];

int main()
{
    double n, p;
    while (cin >>n >>p, n || p)
    {
        printf("%.lf\n", pow(p, 1.0 / n));
    }

    return 0;
}

 

转载于:https://www.cnblogs.com/GetcharZp/p/9351207.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值