您的位置:首页 > 其它

HDU 1060 Leftmost Digit

2014-08-29 15:49 405 查看
题解:利用log,先计算答案的log值,n=n*log10(n),然后,最高位就是小数部分幂还原的整数部分。

#include <cstdio>
#include <cmath>
int T;double n;
int main(){
scanf("%d",&T);
while(T--){
scanf("%lf",&n);
n=n*log10(n); n=n-(long long)n;;
printf("%d\n",(int)pow(10,n));
}return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: