8.18下午

This commit is contained in:
ljcjames 2022-08-18 16:07:09 +08:00
parent 2d24ad3dac
commit 304d6ea774

View File

@ -0,0 +1,41 @@
#include <iostream>
#include<cstdio>
#include<algorithm>
#include <cmath>
using namespace std;
const int mod=1000;
int qpow(int n,int k)
{
int res=1,now=n%mod;//要mod否则会太大10e6*10e6
while(k>0)
{
if(k&1==1)
{
res=res*now%mod;
}
k=k>>1;
now*=now;
now%=mod;
}
return res;//忘return
}
int main()
{
int t,t1=0;
int n,k;
int res1,res2;
double z;
double k10,cur;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&n,&k);
k10=log10(n)*k;
cur=modf(k10,&z);
res1=floor(pow(10,cur)*100);
res2=qpow(n,k);
//%03d 001 000 补齐1前面的0
printf("Case %d: %d %03d\n",++t1,res1,res2);//没有int)导致没有输出
}
return 0;
}