上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 27 下一页
摘要: 先按照题目提示把回文数搞出来,然后挨个判断素数即可。 #include<iostream> #include<set> using namespace std; set<int> s; int a[10]; int m, n; int check(int t){ for(int i = 2; i < 阅读全文
posted @ 2020-10-07 14:05 yys_c 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 题意:从全排列的某一个排列开始向后继续搜索m个,输出这个排列后面的第m个排列 思路:先根据开始的状态,先模拟去搜索一遍,然后通过递归回溯,接着去搜下面的状态。 #include<iostream> #include<vector> using namespace std; const int N = 阅读全文
posted @ 2020-10-07 11:14 yys_c 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题意 给你四个序列,对于每一个序列:枚举序列中的值的选择情况使得已选择的部分和剩下的部分的差值最小。 二进制枚举 可以不写成dfs #include<iostream> using namespace std; const int N = 30, INF = 0x3f3f3f3f; int minv 阅读全文
posted @ 2020-10-06 21:14 yys_c 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 题目描述 有 n 根木棒,现在从中选 4 根,想要组成一个正三角形,问有几种选法? 答案对 $10^9+7$ 取模。 因为固定选4根,所以,必定有两根是作为三角形边长,而另外两根的和为边长。 思路: 统计一下每种长度的木棍个数 枚举可能的三角形长度i 枚举另外两个木棍中的一个的长度$j \in [1 阅读全文
posted @ 2020-10-06 21:04 yys_c 阅读(108) 评论(0) 推荐(0) 编辑
摘要: 老二次元题面了 直接统计 #include<iostream> using namespace std; const int N = 110; char g[N][N]; int r, c, k; int p[N], q[N]; int res; int main(){ cin >> r >> c 阅读全文
posted @ 2020-10-05 21:16 yys_c 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 这题硬模拟就行了,不要搞什么花里胡哨的递归啥的 #include<iostream> #include<vector> using namespace std; const int N = 510; int n, m; int g[N][N]; int b[N]; void dfs(int x, i 阅读全文
posted @ 2020-10-05 19:54 yys_c 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 只看懂前两题。。。 B题:前缀和 // A T G C // A <=> T // C <=> G #include<iostream> using namespace std; const int N = 5010; int a[N], g[N], t[N], c[N]; int n; char 阅读全文
posted @ 2020-10-03 21:14 yys_c 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 题意是求一共淹没几个岛,不是求剩下几个岛(这个更复杂一些,可能会出现岛屿增加的情况),用bfs+flood fill做 #include<iostream> #include<queue> using namespace std; const int N = 1010; #define PII pa 阅读全文
posted @ 2020-10-03 16:34 yys_c 阅读(97) 评论(0) 推荐(0) 编辑
摘要: 问题描述 小张是软件项目经理,他带领3个开发组。工期紧,今天都在加班呢。为鼓舞士气,小张打算给每个组发一袋核桃(据传言能补脑)。他的要求是: 各组的核桃数量必须相同 各组内必须能平分核桃(当然是不能打碎的) 尽量提供满足1,2条件的最小数量(节约闹革命嘛) 输入格式 输入包含三个正整数a, b, c 阅读全文
posted @ 2020-10-03 10:26 yys_c 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 初识懒标记。。。 #include<iostream> #include<cstdio> using namespace std; #define LL long long const int N = 100010; struct Node{ int l, r; LL sum; LL add; // 阅读全文
posted @ 2020-10-02 19:48 yys_c 阅读(107) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16 17 18 19 20 ··· 27 下一页