題目連結: https://zerojudge.tw/ShowProblem?problemid=d171
# 解題思路
logNM = M * logN
所求 =(int)(M*log10 (N))+1 或 floor (log10 (pow (n,m)) + 1 )
# 程式碼
#include<iostream> | |
#include<cmath> | |
using namespace std; | |
int main(){ | |
int m; | |
double n; | |
while(cin>>n>>m){ | |
cout<<(int)(m*log10(n))+1<<endl; | |
} | |
} |