POJ 3181完全背包(+高精)
2024-09-07 15:38:14
思路:
f[i]表示还剩i空间的方案数
套个高精 (网上有人把它拆成了两个long long)
其实这道题的高精并不难写…..
//By SiriusRen
#include <cstdio>
using namespace std;
int n,k,f[1111][53],flag;
int main(){
scanf("%d%d",&n,&k);
f[n][0]=1;
for(int i=1;i<=k;i++)
for(int j=n-i;j>=0;j--)
for(int l=0;l<=50;l++){
int temp=f[j][l]+f[j+i][l];
f[j][l]=temp%10;
f[j][l+1]+=temp/10;
}
for(int i=50;i>=0;i--){
if(f[0][i])flag=1;
if(flag)printf("%d",f[0][i]);
}
}
最新文章
- Hadoop家族的各个成员
- 可以改变this指向的方法
- js Date 函数方法 和 移动端数字键盘调用
- Expect 初学
- 淘宝ip库接口调用
- spring classpath &; classpath*
- shell之here文档
- Kruskal
- js获取客户端IP及地理位置
- 在 IIS MIME 类型中添加 md 扩展名
- unity3d shader之Roberts,Sobel,Canny 三种边缘检测方法
- 评论PK投票功能的手机版
- [TroubleShooting]&;#39;trn\bak&;#39; is incorrectly formed. SQL Server cannot process this media family.
- 设计模式--命令模式(Command)
- 98、vue.js简单入门
- fiddler安装 与 https
- Python——高阶函数——map filter zip
- MySQL 索引的增删查
- 【原创】自己动手写一个能操作redis的客户端
- Swift搭建本地http服务器,实现外部视频即时播放
热门文章
- react-native 编译 undefined is not an object (evaluating &#39;_react2.PropTypes.func&#39;)
- Mysql学习总结(23)——MySQL统计函数和分组查询
- 2015 Multi-University Training Contest 1 hdu 5290 Bombing plan
- How to enable wire logging for a java HttpURLConnection traffic?
- 调用Windows属性窗口
- storm trident function函数
- 错误处理:java.lang.NoSuchMethodException: org.apache.catalina.deploy.WebXml addFilter
- 【C++探索之旅】第二部分第一课:面向对象初探,string的惊天内幕
- json的认识及对json数据的相互转化
- POJ 3277 线段树+扫描线