poj 2109 Power of Cryptography

来源:互联网 发布:淘宝供销怎么改分销 编辑:程序博客网 时间:2024/06/06 04:06

p的范围…相当可怕,本来以为…要上高精度…然后二分…结果…
看代码吧…

double,一个神奇的类型。
(当然啦这题高精度和二分也能过…但是我这么懒…怎么会写呢…
(逃

#include <iostream>#include <cmath>int main(int argc, char *argv[]) {      double n, p;    while(std::cin >> n >> p) {        std::cout <<  pow(p, 1/n) << std::endl;    }    return 0;}