From e704b827acafa9af836cd140dd6b8fa05ef20e2e Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Mon, 8 Aug 2016 17:34:06 +0800 Subject: [PATCH] Create 3555_UESTC_Sayakiss.cpp From http://acm.hdu.edu.cn/discuss/problem/post/reply.php?postid=1366&messageid=1&deep=0 --- HDOJ/3555_UESTC_Sayakiss.cpp | 77 ++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 HDOJ/3555_UESTC_Sayakiss.cpp diff --git a/HDOJ/3555_UESTC_Sayakiss.cpp b/HDOJ/3555_UESTC_Sayakiss.cpp new file mode 100644 index 0000000..71ce898 --- /dev/null +++ b/HDOJ/3555_UESTC_Sayakiss.cpp @@ -0,0 +1,77 @@ +#include +#include +unsigned long long n,ans,sa,nn,np,t,f,i,c[30][30],k,f49; +int fbreak,tcase; +void cc() +{ + int i,j; + c[0][0]=1; + c[1][0]=1;c[1][1]=1; + for (i=0;i<25;i++) + { + c[i][0]=1; + for (j=1;j<=i;j++) c[i][j]=c[i-1][j]+c[i-1][j-1]; + } +} +unsigned long long sayacal(long long n,int k)//10^n +{ + unsigned long long ans; + sa=1;f=1;ans=0; + while (1) + { + sa++;k=k-2;n=n/100;if (n==0) break; + if (f) + { + ans=ans+c[sa+k-1][k]*n; + f=0; + } + else + { + ans=ans-c[sa+k-1][k]*n; + f=1; + } + } + return ans; +} + +int main() +{ + cc();//计算组合数 + scanf("%d",&tcase); + while(tcase--) + { + scanf("%I64d",&n); + if (n<49) {printf("0n");continue;} + ans=0;fbreak=0; + while (n) + { + k=0;nn=1; + while(nn8) + { + ans+=n%nn+1; + fbreak=1; + } + } + printf("%I64dn",ans); + } +}