题解
睡不醒的大南
这个作者很懒,什么都没留下…
展开
-
算法 || 1616 疯狂的采药 完全背包问题 c语言题解
(原题链接) [https://www.luogu.com.cn/problem/P1616]无脑简单版#include <stdio.h>long long max (long long a, long long int b) { return (a > b) ? a : b;}int main() { int t, m; scanf("%d%d", &t, &m); long long b [10000001][1000.原创 2021-09-23 20:09:50 · 219 阅读 · 0 评论 -
算法 || 洛谷 1048 采药 动态规划 c语言
题目链接#include <stdio.h>long long max (long long a, long long int b) { return (a > b) ? a : b;}int main() { int t, m; scanf("%d%d", &t, &m); long long b [101][1001] = {0}; int time[1001], value[101]; //注意这里.原创 2021-09-22 17:28:06 · 169 阅读 · 0 评论 -
算法 || 洛谷 1004 方格取数 动态规划 c 语言版
题目链接#include <stdio.h>long long max (long long a, long long b, long long c, long long d) { a = a > b ? a : b; c = c > d ? c : d; return a > c ? a : c; }int main() { int n; scanf("%d", &n); int map [10][10] .原创 2021-09-22 15:57:08 · 118 阅读 · 0 评论 -
算法 || 洛谷 l002 过河卒 c语言 递归 递推解法 空间压缩
leetcode l002 过河卒 c语言 递归 递推解法(题目链接) [https://www.luogu.com.cn/problem/P1002]递归解法#include <stdio.h>#include <string.h>#include <stdlib.h>long long shortest_path (int x, int y, int m, int n, long long (*hash)[21]) { if(hash[x][y]原创 2021-09-17 21:19:38 · 743 阅读 · 0 评论 -
LeetCode697. 数组的度 hash表|双指针|一遍循环 c语言代码
题目给定一个非空且只包含非负数的整数数组 nums,数组的度的定义是指数组里任一元素出现频数的最大值。你的任务是在 nums 中找到与 nums 拥有相同大小的度的最短连续子数组,返回其长度。示例 1:输入:[1, 2, 2, 3, 1]输出:2解释:输入数组的度是2,因为元素1和2的出现频数最大,均为2.连续子数组里面拥有相同度的有如下所示:[1, 2, 2, 3, 1], [1, 2, 2, 3], [2, 2, 3, 1], [1, 2, 2], [2原创 2021-04-26 12:58:50 · 87 阅读 · 0 评论