news 2026/5/27 16:44:00

代码随想录打卡 第三十六天

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
代码随想录打卡 第三十六天

518 零钱兑换 II

class Solution { public: int change(int amount, vector<int>& coins) { vector<unsigned int> dp(amount+1,0); dp[0] = 1; for(int i = 0; i < coins.size();i++){ for(int j = coins[i];j <= amount;j++){ dp[j] += dp[j-coins[i]]; } } return dp[amount]; } };

377 组合总和 IV

class Solution { public: int combinationSum4(vector<int>& nums, int target) { vector<unsigned int> dp(target+1,0); dp[0] = 1; for(int j = 0;j <= target;j++){ for(int i = 0;i < nums.size();i++){ if(j >= nums[i] ) dp[j] += dp[j-nums[i]]; } } return dp[target]; } };

卡码网 57 爬楼梯

#include<iostream> #include <vector> using namespace std; int main(){ int m; int n; cin >> n >> m; vector<int> dp(n+1,0); dp[0] = 1; for(int i = 0;i <= n;i++){ for(int j = 1;j <= m;j++){ if(i >= j) dp[i] += dp[i - j]; } } cout << dp[n] << endl; }
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/5/27 16:40:22

终极本地AI推理引擎:用llama-cpp-python解锁Python生态的无限可能

终极本地AI推理引擎&#xff1a;用llama-cpp-python解锁Python生态的无限可能 【免费下载链接】llama-cpp-python Python bindings for llama.cpp 项目地址: https://gitcode.com/gh_mirrors/ll/llama-cpp-python 还在为云端AI服务的高延迟和隐私担忧而烦恼吗&#xff1…

作者头像 李华
网站建设 2026/5/27 16:38:54

【C语言】什么是C语言

【C语言】什么是C语言 什么是C语言 什么是语言呢&#xff1f; 在我们的生活中&#xff0c;人与人交流所用的中文&#xff0c;英语&#xff0c;日语等。 那人和计算机交流的语言则可理解为计算机语言&#xff0c;比如&#xff1a;C/C/JAVA/Python/Go 那什么是C语言呢? C语言是一…

作者头像 李华
网站建设 2026/5/27 16:35:00

20种Git操作一键撤销:ugit让你的开发效率提升300%的终极指南

20种Git操作一键撤销&#xff1a;ugit让你的开发效率提升300%的终极指南 【免费下载链接】ugit &#x1f6a8;️ ugit helps undo git commands. Your damage control git buddy. Undo from 20 git scenarios. 项目地址: https://gitcode.com/gh_mirrors/ug/ugit 你是否…

作者头像 李华
网站建设 2026/5/27 16:30:09

AI智能体长周期AI自动化任务,Checkpoint与回滚机制深度设计解析

在AI Agent工程落地的当下&#xff0c;短期对话交互的技术门槛已经逐步降低&#xff0c;真正拉开工程能力差距的&#xff0c;是长期运行、自主迭代、持续操作环境的复杂自动化任务。不管是代码迁移、批量数据处理、项目重构&#xff0c;还是自动化运维&#xff0c;长周期AI任务…

作者头像 李华