当前位置:网站首页>LeetCode 2310. The number of digits is the sum of integers of K
LeetCode 2310. The number of digits is the sum of integers of K
2022-07-02 14:53:00 【HumbleFool】
LeetCode 2310. The number of digits is K The sum of the integers of 
Multiple backpack DP
const int N = 3010;
class Solution {
public:
int f[N][N], v[N]; // front i No more than j The minimum number of
int minimumNumbers(int num, int k) {
int n = 0;
for(int i = k; i <= num; i += 10)
n ++,v[n] = i;
memset(f, 0x3f, sizeof f);
f[0][0] = 0;
for(int i = 1; i <= n; i ++)
for(int j = 0; j <= num; j ++)
{
f[i][j] = f[i - 1][j];
if(j >= v[i])
f[i][j] = min(f[i][j], f[i][j - v[i]] + 1); // Note that f[i][j - v[i]] + 1
}
if(f[n][num] == 0x3f3f3f3f)
f[n][num] = -1;
return f[n][num];
}
};
边栏推荐
- PTA题库 ===>复数四则运算,一帮一,考试座位号(7-73)
- 4. Array pointer and pointer array
- NLA natural language analysis makes data analysis more intelligent
- C语言中的算术运算及相关练习题
- mathjax 入门(web显示数学公式,矢量的)
- Fabric. JS dynamically set font size
- Makefile separates file names and suffixes
- STM32标准固件库函数名(一)
- MFC 定时器使用
- [Space & single cellomics] phase 1: single cell binding space transcriptome research PDAC tumor microenvironment
猜你喜欢

天猫商品详情接口(APP,H5端)

Thoroughly master prototype__ proto__、 Relationship before constructor (JS prototype, prototype chain)

Development and design of animation surrounding mall sales website based on php+mysql

LeetCode 2320. 统计放置房子的方式数

Xilinx Vivado set *.svh as SystemVerilog Header

obsidian安装第三方插件——无法加载插件

电脑怎么设置扬声器播放麦克风的声音

MFC 定时器使用

CTO如何帮助业务?

Fabric. JS free draw circle
随机推荐
socket(套接字)与socket地址
途家木鸟美团夏日折扣对垒,门槛低就一定香吗?
报错:npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
Kityformula editor configure font size and spacing
Socket and socket address
Ad20 cannot select the solution of component packaging in PCB editor
2、const 型指针
kityformula-editor 配置字号和间距
Full of knowledge points, how to use JMeter to generate encrypted data and write it to the database? Don't collect it quickly
taobao.logistics.dummy.send( 无需物流发货处理 )接口,淘宝店铺发货API接口,淘宝订单发货接口,淘宝r2接口,淘宝oAu2.0接口
Threejs controller cube space basic controller + inertia control + flight control
Borui data integrated intelligent observable platform was selected into the "Yunyuan production catalogue" of China Academy of communications in 2022
电脑怎么设置扬声器播放麦克风的声音
Fabric. JS manual bold text iText
Database connection pool and data source
STM32 standard firmware library function name (I)
Makefile 分隔文件名与后缀
tmall. product. schema. Get (product information acquisition schema acquisition), Taobao store upload commodity API interface, Taobao commodity publishing interface, Taobao commodity upload API interf
Makefile separates file names and suffixes
篇9:XShell免费版安装