摘要: [B3635 硬币问题](https://www.luogu.com.cn/problem/B3635 "B3635 硬币问题") ## 方法一:搜索 ```c++ #include using namespace std; int m; int dfs(int n){//求凑够n元的最小硬币数 i 阅读全文
posted @ 2023-08-27 10:39 TFLSNOI 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 题目链接 有序序列合并 学归并排序之前练习 题解 #include<bits/stdc++.h> using namespace std; int a1[1010], a2[1010], a[2020]; int main() { int n, m; cin>>n>>m; for(int i=1; 阅读全文
posted @ 2023-05-04 08:54 TFLSNOI 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 题目链接 https://www.luogu.com.cn/problem/P1088 题解 方法一:20分,暴力枚举,把所有情况列出,找到给出的手势,往后数m个即为答案 #include<bits/stdc++.h> using namespace std; const int maxN=1001 阅读全文
posted @ 2023-03-20 10:52 TFLSNOI 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 题目链接 P1157 组合的输出 题解 #include<bits/stdc++.h> using namespace std; int n, r; int ans[25]; int vis[25]; void dfs(int dep){ if(dep==r+1){ for(int i=1; i<d 阅读全文
posted @ 2023-03-19 10:12 TFLSNOI 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 题目链接 paint 题解 方法一:55分,纯模拟,用二维数组存储网格显然会爆空间,超空间,超时间。 #include<bits/stdc++.h> using namespace std; int t, n, m, q; const int maxN=1e4+10;//如果此处按题意开成1e5会导 阅读全文
posted @ 2023-03-13 11:16 TFLSNOI 阅读(76) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P1102 方法1:二分答案 #include<bits/stdc++.h> using namespace std; int n, c, a[200005]; long long ans; int main() { cin 阅读全文
posted @ 2023-03-12 11:29 TFLSNOI 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://ac.nowcoder.com/acm/problem/16722 差分模版 #include <bits/stdc++.h> using namespace std; #define ll long long ll sum[1000005]; ll a[1000005]; 阅读全文
posted @ 2023-02-26 10:04 TFLSNOI 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://oj.tfls.net/p/176 题解:如果使用双重循环来查找,本题要超时。用哈希表来处理,定义a[x]代表x这个数在数列中是否存在,1代表存在,0代表,只需扫描1~x/2,若数字存在,那么只需要检查看x减去这个数的结果是否在数列里 #include<bits/stdc++ 阅读全文
posted @ 2023-02-24 11:33 TFLSNOI 阅读(149) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P5638 前缀和模拟 #include<bits/stdc++.h> using namespace std; const int max_n=1e6+10; int n, k; long long a[max_n]; l 阅读全文
posted @ 2023-02-23 08:59 TFLSNOI 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P1387 二维前缀和模版题 #include<bits/stdc++.h> using namespace std; int n, m, a[105][105], s[105][105]; int ans; int mai 阅读全文
posted @ 2023-02-19 22:40 TFLSNOI 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P4305 方法一:哈希表 #include<bits/stdc++.h> using namespace std; const int P=10007; int t, n; vector <int> hs[P]; int 阅读全文
posted @ 2023-02-18 18:59 TFLSNOI 阅读(32) 评论(0) 推荐(0) 编辑
摘要: 题目:Eqs 方法一:纯暴力 #include<iostream> using namespace std; int a1, a2, a3, a4, a5; int cnt; int main() { cin>>a1>>a2>>a3>>a4>>a5; for(int x1=-50; x1<=50; 阅读全文
posted @ 2023-02-14 08:37 TFLSNOI 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 题目链接:https://www.luogu.com.cn/problem/P8649 方法一:模拟暴力(20分) #include<bits/stdc++.h> using namespace std; const int max_n=100010; int n, k, a[max_n]; lon 阅读全文
posted @ 2023-02-13 10:12 TFLSNOI 阅读(63) 评论(0) 推荐(0) 编辑
摘要: 最大の和 #include<bits/stdc++.h> using namespace std; int n, k; int a[100010]; long long per_sum[100010], ans; int main() { cin>>n>>k; for(int i=1; i<=n; 阅读全文
posted @ 2023-02-11 11:08 TFLSNOI 阅读(17) 评论(0) 推荐(0) 编辑
摘要: [例题]一维前缀和 #include<bits/stdc++.h> using namespace std; int n, m; int a[100010]; long long per_sum[100010]; int l, r; int main() { cin>>n>>m; for(int i 阅读全文
posted @ 2023-02-11 10:47 TFLSNOI 阅读(21) 评论(0) 推荐(0) 编辑