复习一下快速幂
#include<bits/stdc++.h>
using namespace std;
int main()
{
long long a,b,c,p,t,ans=1;
cin>>a>>b>>p;
t=a;
c=b;
while(b>0)
{
if(b&1)
{ ans*=t;
ans%=p;
}
t*=t;
t%=p;
b>>=1;
}
printf("%d^%d mod %d=%d",a,c,p,ans);
}
dp 最大子段和
P1115 最大子段和 - 洛谷 | 计算机科学教育新生态 (luogu.com.cn)
0x3f3f3f3f 表示无穷大