CCF
hbulzh
这个作者很懒,什么都没留下…
展开
-
CCF CSP 化学方程式
模拟题 + 简单的递归 #include <bits/stdc++.h> using namespace std; //2H2+2Cl2=4HCl int find_ep(string &s) { for(int i = 0; i < s.size(); ++ i) if(s[i] == '=') return i; return -1; } //2 //H2 void work_2(string word, map<string,int> &am原创 2021-03-02 22:13:43 · 260 阅读 · 0 评论 -
CCF CSP 有趣的数
#include <iostream> #include <cstring> using namespace std; const int N = 1e3+10, mod = 1e9+7; int n; int C[N][N]; void init() { for(int i = 0; i < N; ++ i) for(int j = 0; j <= i; ++ j) if(!j) C[i][j] = 1; ...原创 2021-02-24 17:00:30 · 141 阅读 · 0 评论 -
2020-09-3 CCF CSP 点亮数字人生(拓扑排序 判环)
经典急了急了。。 第三题判断环的存在有一万种方式,拓扑排序,甚至撸上去一个tarjan都行,非自己图快意淫出一个不存在的递归算法然后把心态调崩了。。导致只拿了五十分。 100分: #include <bits/stdc++.h> using namespace std; const int N = 1e5+10; vector<int> iput[N], oput[N]; string op[N]; int du[N],bdu[N]; int h[N], tot, n, m;原创 2021-03-02 22:12:50 · 435 阅读 · 0 评论 -
CCF CSP 201403-4 网络延迟
树的最长直径 #include <iostream> #include <cstring> using namespace std; const int N = 1e5+10; int d[N], ans; int h[N], tot, vis[N]; struct Edge{ int to,nxt,w; }e[N << 1]; void add(int a,int b,int c) { e[tot].to = b, e[tot].w = c, e[原创 2020-09-03 15:23:43 · 159 阅读 · 0 评论 -
CCF CSP 201909-5 城市规划
有依赖的树形背包问题 第一维 循环物品 第二维 循环体积 第三维 循环决策 #include <bits/stdc++.h> #define LL long long using namespace std; const int N = 1e5+10, M = 5e5+10; const int INF = 1e15; int h[N], ep; struct Edge{ int to, nxt, w; }e[M]; int n, m, K; int du[N], vis[N], .原创 2020-08-31 15:44:26 · 665 阅读 · 0 评论 -
CCF CSP201912-4 区块链
说明:大多数网上说这个题目是stl跟bfs 这里纠正一下除了一开始建一个图之外 其余跟图没有半点关系,stl也只用了一个队列,手写完全没有问题,如果你看到的博客说是stl或者bfs的话,大概率他没实现 或者没写对 或者超时。 正解是写一个结构体存时间 对其排序 插入块或者查找之前对队列中之前的时间的任务都取出执行 原代码思想:用priority_queue对 执行时间进行排序 但是超时 参考代码:改成普通队列就可以过 但是根据分析t 不是严格递增的 这样bfs中的判断是有问题的 但是竟然可以过。感觉测试原创 2020-08-30 21:13:49 · 324 阅读 · 0 评论 -
CCF CSP 201809-4 再卖菜
bfs + 记忆化搜索(剪枝) #include <bits/stdc++.h> using namespace std; const int N = 310; int a[N],b[N],f[N][N][N],n; bool dfs(int u) { if(u == n + 1) { if((a[n - 1] + a[n]) / 2 == b[n]) return true; return false; } for(int i = 0; i < 3; ++i) {原创 2020-08-18 23:42:49 · 180 阅读 · 0 评论 -
CCF CSP 201909-3 字符画
调试字符串模拟的代码可 太虚了。。 #include <bits/stdc++.h> using namespace std; const string ESC(1, char(27)); int n, m, p, q; struct node{ int r, g, b; bool operator!=(const node &y)const { return r != y.r || g != y.g || b != y.b; } }RGB[2000][2000]; i原创 2020-08-18 18:53:38 · 242 阅读 · 0 评论 -
CCF CSP 2020-06-03 Markdown渲染器
#include <bits/stdc++.h> using namespace std; int w; struct Node { string s; int f; // 1段落 2项目开头 3项目第2-n段落 }; vector<Node> all; bool f2(string &str) { return str.size() >= 2 && str[0] == '*' && str[1] == ' '; } .原创 2020-08-17 22:40:55 · 740 阅读 · 0 评论 -
CCF CSP 2020-06-05 乔乔和牛牛逛超市
买了x才能买y 等价于要想得到y的最大收益就必须连带着把x的最大收益(即使可能<0)也得收下,这个模型是典型的最大权闭合子图,答案应该是图中正的点权和-最小割的容量。最小割跑最大流模板就可得到。但是第二类点的建图方式还没想到,可能是需要拆点。 #include <iostream> #include <cstring> #include <algorithm> #include <cmath> #define LL long long using n原创 2020-08-10 16:08:07 · 2085 阅读 · 2 评论 -
CCF CSP 推荐系统
#include <iostream> #include <cstring> #include <algorithm> #include <set> #include <unordered_map> #define LL long long #define PII pair<LL,LL> using namespace std; const LL MUL = 1e9 + 10; unordered_map<LL,int> .原创 2020-08-05 13:18:24 · 452 阅读 · 3 评论 -
CCF CSP 消息传递接口
#include <bits/stdc++.h> using namespace std; const int N = 1e5+10; char str[N]; int in[N]; struct Node{ int s,f,t; }; vector<Node> procs[N]; Node q[N]; int n; bool deal() { int top = 0; q[++ top] = procs[0].back(); procs[0].pop_back(); in[.原创 2020-08-04 11:17:13 · 362 阅读 · 0 评论 -
CCF CSP 2020-06-04 1246
根据最大的测试数据 n可取到1e9 可知 应该采取logn或者 根号n的 复杂度的算法 目测是一个动态规划 然后利用矩阵乘法来加速运算,根据输入的字符串推出他是由1246中的哪一个转移形成的 然后输出即可 #include <bits/stdc++.h> #define LL long long using namespace std; const int mod = 998244353; int n; string s; LL a[4][4] = { 0,1,0,0, 0,0,1,0原创 2021-01-21 17:08:50 · 2657 阅读 · 13 评论 -
CCF 地铁修建
最小生成树 + 并查集 #include <bits/stdc++.h> using namespace std; const int N = 1e+5+10; int n,m; struct Edge{ int x; int y; int l; }; int a[N]; vector<Edge>v; bool cmp(const Edge &a,con...原创 2019-03-13 11:00:35 · 250 阅读 · 0 评论 -
CCF 权限查询
题意官网有,大致思路就是整一堆结构体,存起来 挨个查就行了 #include <bits/stdc++.h> using namespace std; struct qx{ string name; int level = 0; }; struct js{ string name; vector<qx> jqx; }; struct user{ string ...原创 2019-03-12 18:12:51 · 201 阅读 · 0 评论 -
ccf Markdown
电子竞技,菜是原罪,只有90分。。。。。 死活找不到错在哪儿 #include <bits/stdc++.h> using namespace std; void print(string sentence){ for(int i = 0; i < sentence.size(); i++){ if(sentence[i] == '['){ string t...原创 2019-03-10 20:51:51 · 170 阅读 · 0 评论 -
CCF 管道中心
题意:求最小生成树中的最大权值的边 #include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,m,root; const int N = 1e5 + 10; struct Edge{ int l; int r; int value; }; vector<Edge> v; vecto...原创 2019-03-06 10:39:35 · 120 阅读 · 0 评论 -
CCF 小明放学
#include <bits/stdc++.h> using namespace std; long long r,y,g; long long n; char flag; long long t; long long tim = 0; vector<char> v; int main(){ //ifstream in; //in.open("ryg.txt"); ...原创 2019-03-05 14:37:50 · 338 阅读 · 0 评论