最佳加法表达式
来源:互联网 发布:数据库后台做什么 编辑:程序博客网 时间:2024/04/29 03:18
#include<iostream>#include<cstring>using namespace std;char s[10005];int m;int num(int x,int y){ int result=0; int i; for(i=x;i<=y;i++) result=result*10+s[i]-'0'; return result;}int V(int m,int n){ int i; int minvalue=1<<30; if(m==0) return num(0,n-1); for(i=m;i<n;i++){ minvalue=min(V(m-1,i)+num(i,n-1),minvalue); } return minvalue;}int main(){ int len; cin>>s>>m; len=strlen(s); cout<<V(m,len)<<endl; return 0;}
0 0
- 最佳加法表达式 dp
- 最佳加法表达式 dp
- dp 最佳加法表达式
- 最佳加法表达式
- dp 最佳加法表达式
- 最佳加法表达式
- 最佳加法表达式
- 最佳加法表达式
- 最佳加法表达式
- 最佳加法表达式
- 最佳加法表达式(dp)
- 最佳加法表达式-动态规划
- 最佳加法表达式(dp)
- DP入门 最佳加法表达式
- 最佳加法表达式(DP)
- 动态规划-最佳加法表达式
- 最佳加法表达式(动态规划)
- dp 动规 最佳加法表达式
- Fence Repair 【优先队列】
- STM32F107——W5500网络通信
- visual studio code
- Struts2 学习笔记3
- Codeforces 540D Bad Luck Island【概率dp】
- 最佳加法表达式
- 浏览器内核
- c++ 静态成员函数
- android studio 框架搭建:加入注解框架Annotations
- Java学习【代码1】
- java学习笔记3.28
- Introduction to the DICOM Standard
- Java BIO、NIO、AIO 分析
- 计算各种图形的周长(接口与多态)