lightoj1282
来源:互联网 发布:it治理与it管理的区别 编辑:程序博客网 时间:2024/06/17 01:27
题意是求一个数的前三位和后三位,特别注意后三位是0的情况,一定要%03lld矫正一下
#include<cstdio>#include<cmath>#define ll long longusing namespace std;ll n,k;ll mod_pow(ll x,ll w){ ll res=1; while(w>0) { if(w&1) res=res*x%1000; x=x*x%1000; w>>=1; } return res;}double ws(){ double w=k*log10(n); double x=w-(ll)(w); return x;}int solve(){ double d=ws(); ll temp=(ll)(pow(10,d)*100.0); ll tmp=mod_pow(n,k); printf("%lld %lld\n",temp,tmp);}int main(){ int T,cas=1; scanf("%d",&T); while(T--) { scanf("%lld %lld",&n,&k); printf("Case %d: ",cas++); solve(); } return 0;}
0 0
- lightoj1282
- LightOJ1282
- lightoj1282 - Leading and Trailing
- 【lightoj1282】数学-小知识点
- Leading and Trailing LightOJ1282
- lightoj1282 - Leading and Trailing(水题)
- Lightoj1282(HDOJ1060) - Leading and Trailing
- LightOJ1282 Leading and Trailing 大数取首尾
- lightoj1282:Leading and Trailing(数论)
- Lightoj1282——Leading and Trailing(幂取模求前三位)
- LightOJ1282 Leading and Trailing(截取前n位输出)
- LightOj1282(阶乘前三位和后三位)
- Mac android studio升级时提示 :Connection failed. Please check your network connection .
- Http Response Splitting and Cache poisoning
- 链式表达
- Linux学习笔记(用户管理)
- [LeetCode 67]Add Binary
- lightoj1282
- 心得(1)
- 单链表及在其上的操作实现
- 已知二叉树的中序遍历和后序遍历,求先序遍历
- PHP获得文件列表
- c与c++区别
- Plus One
- 调用WCF服务
- LeetCode Excel Sheet Column Title