zoukankan      html  css  js  c++  java
  • SDNU 1102.小树林(水题)

    Description

    LG家门口有一片小树林,在小树林中央有一块写有相关说明的标牌,其中关于树木数量的部分是这么写的:
    “……这片树林中的树木可构成a个以这块标牌为圆心的同心圆,其中最靠近这块标牌的圆上有b棵树,其他圆上树木数量都是向内一层的圆上树木数量的c倍。……”
    试求LG家门口这片小树林有多少树木。

    Input

    一行,三个正整数 a b c

    Output

    一行,计算结果,保证不会太大(不需要用高精度)

    Sample Input

    63 1 2

    Sample Output

    9223372036854775807

    Source

    Unknown
    #include <cstdio>
    #include <iostream>
    #include <string>
    #include <cstring>
    #include <cmath>
    #include <algorithm>
    #include <queue>
    #include <map>
    #include <vector>
    using namespace std;
    
    #define ll long long
    
    unsigned ll a, b, c;//如果不行,就改为ll
    unsigned ll sum = 0, s= 0;
    
     unsigned ll qsm(unsigned ll x, unsigned ll y)
     {
         unsigned ll ans = 1;
         while(y)
         {
             if(y&1)ans = ans*x;
             y /= 2;
             x *= x;
         }
         return ans;
     }
    
     int main()
     {
         scanf("%llu%llu%llu", &a, &b, &c);
         sum = qsm(c, a);
         sum = (sum-1)*b/(c-1);
         printf("%llu
    ", sum);
         return 0;
     }
  • 相关阅读:
    关于权限控制
    关于<!DOCTYPE>
    Oracle恢复目录的管理使用简要
    绑定变量介绍
    重做日志时间戳说明
    UNDO表空间监控说明
    Oracle rac进阶管理专家指导系列文档
    延迟块清除介绍
    ORA12500内存耗尽一例
    undo自动调优介绍
  • 原文地址:https://www.cnblogs.com/RootVount/p/10946648.html
Copyright © 2011-2022 走看看