标签:大小 mes const its inline can pre 表示 有一个
Descrption
Input
Output
Sample Input
233
Sample Output
1167892
Hint
分析
Code
#include<bits/stdc++.h>
using namespace std;
#define RI register int
const int mod=23333333,N=100005;
int n,sqn,ans,f[2][N],g[335][N],f1[N],f2[N];
int qm(int x) {return x>=mod?x-mod:x;}
void work1() {
f[0][0]=1;
for(RI i=1,t=1;i<=sqn;++i,t^=1)
for(RI j=0;j<=n;++j) {
f[t][j]=f[t^1][j];
if(j>=i) f[t][j]=qm(f[t][j]+f[t][j-i]);
if(j>=i*(i+1)) f[t][j]=qm(f[t][j]-f[t^1][j-i*(i+1)]+mod);
}
for(RI i=0;i<=n;++i) f1[i]=f[sqn&1][i];
}
void work2() {
g[0][0]=1;
for(RI i=0;i<=sqn;++i)
for(RI j=0;j<=n;++j) {
f2[j]=qm(f2[j]+g[i][j]);
if(i&&j+i<=n) g[i][j+i]=qm(g[i][j+i]+g[i][j]);
if(j+sqn+1<=n) g[i+1][j+sqn+1]=qm(g[i+1][j+sqn+1]+g[i][j]);
}
}
int main()
{
scanf("%d",&n);sqn=sqrt(n);
work1(),work2();
for(RI i=0;i<=n;++i) ans=qm(ans+1LL*f1[i]*f2[n-i]%mod);
printf("%d\n",ans);
return 0;
}
标签:大小 mes const its inline can pre 表示 有一个
原文地址:https://www.cnblogs.com/hbhszxyb/p/13283417.html