您的位置:首页 > 大数据 > 人工智能

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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  Number Theory1 of bo