上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页
摘要: #include <bits/stdc++.h> using namespace std; int main() { int count =0,huoguo=0; int flag = 0;//第一次出现是第几条 string s; while (getline(cin, s) && s != ". 阅读全文
posted @ 2024-03-29 20:11 YuKiCheng 阅读(32) 评论(0) 推荐(0)
摘要: easy. #include <bits/stdc++.h> using namespace std; set<pair<int, int>> st; int maxv = 0; int main() { for(int i=1;i<=4;i++){ int t; cin >> t; st.inse 阅读全文
posted @ 2024-03-29 19:44 YuKiCheng 阅读(45) 评论(0) 推荐(0)
摘要: 这题没做出来,查了一些博客,下面是我比较能接受的一种写法。 读完题可以发现这是一个满二叉树,并且可以得到每场比赛失败者的信息(决赛是胜利者和失败者都可以得到) 对于一场比赛,它的胜利者要么是左孩子中的胜利者,要么是右孩子中的胜利者,那我们就可以先假设是左孩子的胜利者,如果不行就交换(是右孩子的胜利者 阅读全文
posted @ 2024-03-29 16:59 YuKiCheng 阅读(341) 评论(1) 推荐(1)
摘要: 喔,太久没敲代码了,有点生疏了。 baozang[i]=1:第i块岛屿有宝藏。 baozang[i]=0: 第i块岛屿没有宝藏。 #include <bits/stdc++.h> using namespace std; vector<vector<int>> area; int row, col; 阅读全文
posted @ 2024-03-29 11:10 YuKiCheng 阅读(155) 评论(0) 推荐(0)
摘要: 和这道题真的有壁,拿起来就做,然后做错了。又看了半天题目,才知道大概啥意思。 每一轮都需要给人数最多的学校分配位置,如果人数大于c,分配一个教室剩下的人还要再放回进行第二轮,而不是一次性给这个学校分配完。 #include <bits/stdc++.h> using namespace std; c 阅读全文
posted @ 2024-03-28 19:49 YuKiCheng 阅读(305) 评论(0) 推荐(0)
摘要: 纯模拟。 #include <bits/stdc++.h> using namespace std; int cnt = 0,maxlen=0; int main() { vector<int> a, b; int n; cin >> n; for (int i = 0; i < n; i++) { 阅读全文
posted @ 2024-03-28 15:20 YuKiCheng 阅读(143) 评论(0) 推荐(0)
摘要: 测试点4一开始没过去,以为是数据范围的问题。 找半天才发现是floyd三层循环k那个写反了,害。 #include <bits/stdc++.h> using namespace std; vector<int> male,female; int dis[510][510]; int main() 阅读全文
posted @ 2024-03-28 12:39 YuKiCheng 阅读(75) 评论(0) 推荐(0)
摘要: 考察的是贪心+记忆化搜索。 最短路=走过的路径*2-从根到小区最深路径长度 #include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; int p[maxn],dis[maxn],dp[maxn]; int max 阅读全文
posted @ 2024-03-28 09:10 YuKiCheng 阅读(96) 评论(0) 推荐(0)
摘要: ​一,重入锁定义 重入锁,顾名思义,就是支持重新进入的锁,表示这个锁能够支持一个线程对资源重复加锁。如果一个线程已经拿到了锁,那么他需要再次获取锁的时候不会被该锁阻塞。 举个例子, public synchronized void test(){ do something... test2(); } 阅读全文
posted @ 2024-03-27 15:36 YuKiCheng 阅读(186) 评论(0) 推荐(0)
摘要: 代码很烂。 #include <bits/stdc++.h> using namespace std; struct node { int start[10]; int end[10]; }s[100000]; bool cmp(node n1,node n2) { for (int i = 0; 阅读全文
posted @ 2024-03-25 17:11 YuKiCheng 阅读(71) 评论(0) 推荐(0)
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 17 下一页