摘要: 1 #include <iostream> 2 #include <cstdio> 3 4 using namespace std; 5 6 template <class T> 7 inline void read(T &s) 8 { 9 s = 0; 10 int w = 1; 11 char 阅读全文
posted @ 2023-11-21 22:48 上原歩夢 阅读(23) 评论(0) 推荐(0)
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 template <class T> 4 inline void read(T &s) 5 { 6 s = 0; 7 int w = 1; 8 char ch = getchar(); 9 whi 阅读全文
posted @ 2023-11-21 22:47 上原歩夢 阅读(31) 评论(0) 推荐(0)
摘要: /* https://blog.csdn.net/sugarbliss/article/details/86495945?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522169977002316800215045285%2522%252 阅读全文
posted @ 2023-11-21 22:46 上原歩夢 阅读(28) 评论(0) 推荐(0)
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 string s1, s2; 4 vector<int> find_next(vector<int> next, string s) 5 { 6 int i = 1, prefix = 0, le 阅读全文
posted @ 2023-10-22 15:19 上原歩夢 阅读(21) 评论(0) 推荐(0)
摘要: 题解: 模拟棋子移动,最后几行找不到规律所以直接打表 1 #include <bits/stdc++.h> 2 using namespace std; 3 int n; 4 char s[500]; 5 void init() 6 { 7 for (int i = 0; i < n; ++i) 8 阅读全文
posted @ 2023-09-01 15:50 上原歩夢 阅读(47) 评论(0) 推荐(0)
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 int k, x, y; 4 5 int judge(int x, int y, int gx, int gy, int len) // 判断障碍物在哪个区块 6 { 7 if (gx <= x 阅读全文
posted @ 2023-09-01 15:49 上原歩夢 阅读(58) 评论(0) 推荐(0)
摘要: 题解: 利用快速排序的思想来寻找第k小的数,可以避免很多不必要的操作 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int N = 5000005, M = 5e6 + 5; 4 int x[N], k; 5 inline int 阅读全文
posted @ 2023-08-18 17:27 上原歩夢 阅读(39) 评论(0) 推荐(0)
摘要: 题解: 这道题最大的坑:32 和 321,32321 > 32132 1 #include <bits/stdc++.h> 2 using namespace std; 3 string a[25]; 4 bool cmp(const string &a, const string &b) 5 { 阅读全文
posted @ 2023-08-18 17:23 上原歩夢 阅读(25) 评论(0) 推荐(0)
摘要: 题解: 这道题的关键是找到状态转移方程,从最底层(n)开始,计算上面全部(n, n - 1, n - 2 …… 1)层的总表面积和总体积,从而来确定使表面积最小的S 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define S(r) (( 阅读全文
posted @ 2023-07-24 23:42 上原歩夢 阅读(58) 评论(0) 推荐(0)
摘要: 题解: 这段代码实现了一个递归的记忆化搜索算法,用于解决一个求最大蛋糕面积下限的问题。下面解释一下其递归思路: 定义状态 设 ways[w][h][m] 表示当前蛋糕的宽度为 w,高度为 h,已经切了 m 刀时,最大蛋糕面积的下限。 状态转移 对于当前的蛋糕,可以选择竖着切一刀或者横着切一刀。竖着切 阅读全文
posted @ 2023-07-15 12:06 上原歩夢 阅读(49) 评论(0) 推荐(0)