HDU 1060 Leftmost Digit
2013-06-18 21:13
471 查看
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1060
取对数,然后求小数部分,然后求幂,ok
代码如下:
取对数,然后求小数部分,然后求幂,ok
代码如下:
#include <iostream> #include <cstdio> #include <cstdlib> #include <cmath> #include <cstring> #include <string> #include <vector> #include <list> #include <deque> #include <queue> #include <iterator> #include <stack> #include <map> #include <set> #include <algorithm> #include <cctype> using namespace std; const int N=1001; typedef long long LL; int main() { int i,j,n,T; cin>>T; while(T--) { scanf("%d",&n); double t=n*log10(double(n));//取对数 LL a=(LL)t;//整数部分表示位数-1 t-=a;//小数部分 t=pow(10.0,t); a=(LL)t; while(a==0) { t*=10; a=(LL)t; } printf("%d\n",a); } return 0; }
相关文章推荐
- HDU 1060 LeftMost Digit
- hdu 1060 Leftmost Digit
- hdu 1060 Leftmost Digit
- hdu 1060 Leftmost Digit
- Hdu 1060 Leftmost Digit
- hdu 1060 Leftmost Digit
- hdu 1060 Leftmost Digit(幂次方最高位)
- HDU 1060 Leftmost Digit(数论)
- hdu-1060-Leftmost Digit
- HDU1060 Leftmost Digit (数学推导)
- HDU - 1060 Leftmost Digit (数学取对数)规律
- HDU 1060 Leftmost Digit
- Leftmost Digit HDU - 1060
- hdu 1060 Leftmost Digit
- Leftmost Digit HDU 1060
- HDU 1060 Leftmost Digit
- hdu 1060 Leftmost Digit
- hdu 1060——Leftmost Digit
- HDU 1060 Leftmost Digit
- hdu 1060 Leftmost Digit