背包问题 tyvj1172
生活随笔
收集整理的这篇文章主要介绍了
背包问题 tyvj1172
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
tyvj日常挂……,改日再测评
1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #include<algorithm> 5 using namespace std; 6 int n; 7 unsigned int f[4010]; 8 int main(){ 9 scanf("%d",&n); 10 memset(f,0,sizeof(f)); 11 f[0]=1; 12 for(int i=1;i<=n;i++) 13 for(int j=i;j<=n;j++) f[j]+=f[j-i];//unsigned int 自然溢出等价于取模 14 printf("%u",f[n]-1); 15 return 0; 16 }
转载于:https://www.cnblogs.com/sdfzxh/p/7153233.html
总结
以上是生活随笔为你收集整理的背包问题 tyvj1172的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: Spring3+ibatis (SQL
- 下一篇: 字符串过长用...代替,鼠标悬停显示所有