本文共 1494 字,大约阅读时间需要 4 分钟。
又傻掉了呢
#include #include #include #include #include #include #include #include #include #include #define N 120#define L 110#define eps 1e-7#define inf 1e9+7#define db double#define ll long long#define ldb long doubleusing namespace std;inline ll read(){ char ch=0; ll x=0,flag=1; while(!isdigit(ch)){ch=getchar();if(ch=='-')flag=-1;} while(isdigit(ch)){x=(x<<3)+(x<<1)+ch-'0';ch=getchar();} return x*flag;}const ll g=3;const ll p=998244352;const ll mo=998244353;struct matrix { ll s[N][N]; void clear(){memset(s,0,sizeof(s));}};matrix operator*(matrix a,matrix b){ matrix ans; ans.clear(); for(ll i=0;i<=L;i++) for(ll j=0;j<=L;j++) for(ll k=0;k<=L;k++) ans.s[i][j]=(ans.s[i][j]+(a.s[i][k]*b.s[k][j]%p))%p; return ans;}matrix ksm(matrix x,ll k){ matrix ans; ans.clear(); for(ll i=0;i<=L;i++)ans.s[i][i]=1; while(k) { if(k&1)ans=ans*x; k>>=1; x=x*x; } return ans;}matrix f;ll qpow(ll x,ll k){ ll ans=1; while(k) { if(k&1)ans=ans*x%mo; k>>=1; x=x*x%mo; } return ans;}ll X,Y;ll exgcd(ll a,ll b){ if(!b){X=1,Y=0;return a;} ll d=exgcd(b,a%b); ll t=X;X=Y,Y=t-(a/b)*Y; return d;}map S;map ::iterator it;ll bsgs(ll a,ll n){ S.clear(); ll x=1,k=1,len=sqrt(mo); for(ll i=0;i {x,i}); for(ll i=0;i second); } return 0;}int main(){ ll k=read(); f.clear(); for(ll i=1;i
转载于:https://www.cnblogs.com/Creed-qwq/p/10349300.html