[2016-04-14][codeforces][630][B][Moore's Law]

  • 时间:2016-04-14 18:38:28 星期四

  • 题目编号:[2016-04-14][codeforces][630][B][Moore’s Law]

  • 题目大意:求n1.000000011p

  • 分析:p特别大,用快速幂算法

  1. #include<cstdio>
  2. using namespace std;
  3. double base = 1.000000011;
  4. double mpow(double a,int p){
  5. double ans = 1;
  6. while(p > 0 ){
  7. if(p & 1){
  8. ans = ans * a;
  9. }
  10. p >>= 1;
  11. a = a * a;
  12. }
  13. return ans;
  14. }
  15. int main(){
  16. int n,p;
  17. scanf("%d%d",&n,&p);
  18. printf("%.7f\n",n * mpow(base,p));
  19. return 0;
  20. }


来自为知笔记(Wiz)


posted on 2016-04-14 18:41  红洋  阅读(124)  评论(0)    收藏  举报

导航