当前位置:网站首页>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];
}
};
边栏推荐
- Li Chuang EDA learning notes 15: draw border or import border (DXF file)
- Kityformula editor configure font size and spacing
- Development and design of animation surrounding mall sales website based on php+mysql
- Advanced usage of C language -- function pointer: callback function; Conversion table
- STM32 standard firmware library function name memory (II)
- tmall.product.schema.get( 产品信息获取schema获取 ),淘宝店铺上传商品API接口,淘宝商品发布接口,淘宝商品上传API接口,店铺上传接口,oAuth2.0接口
- geoserver离线地图服务搭建和图层发布
- It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen
- Delete element (with transition animation)
- Fabric. JS manual bold text iText
猜你喜欢
Fabric.js 缩放画布
【无标题】LeetCode 2321. 拼接数组的最大分数
C#代码审计实战+前置知识
CTO如何帮助业务?
Yolov6 training: various problems encountered in training your dataset
Pychart connects to the remote server
Large top heap, small top heap and heap sequencing
It's no exaggeration to say that this is the most user-friendly basic tutorial of pytest I've ever seen
途家木鸟美团夏日折扣对垒,门槛低就一定香吗?
Fabric. JS upper dash, middle dash (strikethrough), underline
随机推荐
微信小程序使用towxml显示公式
Full of knowledge points, how to use JMeter to generate encrypted data and write it to the database? Don't collect it quickly
【NOI模拟赛】刮痧(动态规划)
Yolov6 training: various problems encountered in training your dataset
Threejs controller cube space basic controller + inertia control + flight control
YoloV6训练:训练自己数据集遇到的各种问题
qml 弹窗框架,可定制
3. Function pointers and pointer functions
NLA natural language analysis realizes zero threshold of data analysis
由粒子加速器产生的反中子形成的白洞
taobao.trade.get( 获取单笔交易的部分信息),淘宝店铺订单接口,淘宝oAuth2.0接口,淘宝R2接口代码对接分享
Actual combat sharing of shutter screen acquisition
Fabric. Keep the original level when JS element is selected
Why can't browsers read JSX?
Fabric. JS manual bold text iText
[QNX hypervisor 2.2 user manual]6.3 communication between guest and external
Development and design of animation surrounding mall sales website based on php+mysql
Some Chinese character codes in the user privacy agreement are not standardized, which leads to the display of garbled codes on the web page. It needs to be found and handled uniformly
STM32标准固件库函数名记忆(二)
Socket and socket address