Leading and Trailing
2013-08-29 22:26
218 查看
http://www.bnuoj.com/bnuoj/contest_show.php?cid=2322#problem/25809
// File Name: bo_jwolf12.cpp // Author: rudolf // Created Time: 2013年08月29日 星期四 13:19:53 #include<vector> #include<list> #include<map> #include<set> #include<deque> #include<stack> #include<bitset> #include<algorithm> #include<functional> #include<numeric> #include<utility> #include<sstream> #include<iostream> #include<iomanip> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<ctime> using namespace std; int mod( int n , int k ) { if( k == 1 ) return n % 1000 ; int temp = mod( n , k / 2 ) ; if( k % 2 == 0 ) return temp * temp % 1000 ; else return temp * temp * mod( n , 1 ) % 1000 ; } int main() { int Case ; int n , k ; double temp1 , temp2 ; cin >> Case ; while( Case-- ) { cin >> n >> k ; temp1 = ( double ) k * log10( n ) ; temp1 = temp1 - ( int ) temp1 ; temp1 = pow( ( double ) 10 , 2 + temp1 ) ; printf( "%d...%03d\n" , ( int ) temp1 , mod( n , k ) ) ; } return 0; }
相关文章推荐
- E - Leading and Trailing 求n^k得前三位数字以及后三位数字,保证一定至少存在六位。
- UVA 11029 Leading and Trailing
- LightOJ - 1282 B - Leading and Trailing——快速幂运算
- Light-oj 1282 - Leading and Trailing
- LightOJ1282 Leading and Trailing 大数取首尾
- LOJ1282 Leading and Trailing(数论)
- lightoj 1282 - Leading and Trailing 【数学】
- UVA 11029 Leading and Trailing [数学]
- uva11029 - Leading and Trailing
- 【Light-oj】-1282 - Leading and Trailing(数论,快速幂,log,好)
- uva 11029 Leading and Trailing
- lightoj 1282 Leading and Trailing(求n^k的前三位后三位)
- 【LightOJ1282】Leading and Trailing(数论)
- Light OJ 1282 Leading and Trailing
- B - Leading and Trailing LightOJ - 1282(数学加快速幂)
- LightOJ 1282 Leading and Trailing
- LightOJ 1282 Leading and Trailing
- 【LightOJ】1282 - Leading and Trailing(快速幂 & 数论)
- 【LightOJ1282】Leading and Trailing(数论)
- UVa 11029 Leading and Trailing (如何计算n^k的开头三位和末尾三位?)