题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6217
百度BBP解释:https://wenku.baidu.com/view/716dbac708a1284ac85043bf.html
板子,不会,别问我
#include <cstdio>
#include<iostream>
using namespace std;
typedef long long ll;
ll remain( ll m, ll n, ll k, ll extra)
{
ll temp1=1,temp2=1;
if(n==0)return extra%k;
if(n==1)return (m*extra)%k;
while(n>1)
{
temp1=m;
temp1*=temp1;
if(temp1>=k)temp1%=k;
if(n%2