63 1 2
9223372036854775807
#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\n", sum); return 0; }
原文:https://www.cnblogs.com/RootVount/p/10946648.html