提交时间:2021-05-27 22:20:29
运行 ID: 20032
#include<bits/stdc++.h> using namespace std; int i,j,x,len=0,len1=0,tot=0,a[1000]={0},ans=0,cj[1000]={0}; int main(){ cin>>x; for(i=2;tot+i<=x;++i)++len,tot+=i,a[len]=i; len1=len,x=x-tot; for(i=x;i>=1;--i)a[len1]++;len1--; if(x>len)a[len]++; cj[1]=a[1];len1=1; for(i=2;i<=len;++i){ for(j=1;j<=len1;++j)cj[j]=cj[j]*a[i]; for(j=1;j<=len1;++j){ cj[j+1]+=cj[j]/10; cj[j]%=10; } while(cj[len1+1]>0){ len1++,cj[len1+1]=cj[len1]/10; cj[len1]%=10; } } for(i=1;i<=len1;++i)ans+=cj[i]; cout<<ans<<endl; return 0; }