题目:求指数
题意:已知X,N,求Y ,使得X的Y次方等于N。
思路:<math.h>中函数 pow(double a,double b)
代码:
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
double x,y;
int t;
while(cin>>x>>y)
{
t=pow(y,1/x)+0.5;
cout<<t<<endl;
}
return 0;
}
题目:求指数
题意:已知X,N,求Y ,使得X的Y次方等于N。
思路:<math.h>中函数 pow(double a,double b)
代码:
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
double x,y;
int t;
while(cin>>x>>y)
{
t=pow(y,1/x)+0.5;
cout<<t<<endl;
}
return 0;
}