上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页
摘要: 测试点会出现-0这种,直接导致无法使用int类型接收编号,因为无从判断性别,因此只能用string类型。 并且需要使用sex来记录当前是男性还是女性,只有对方是异性的时候,亲密度才有意义。 #include <bits/stdc++.h> using namespace std; int p[101 阅读全文
posted @ 2024-03-19 18:20 YuKiCheng 阅读(45) 评论(0) 推荐(0)
摘要: 很容易就AC了但是真没get到这道题有啥用这个所谓的排名。 #include <bits/stdc++.h> using namespace std; struct node { string s; int zp; int rank; }s[10010]; bool cmp(node n1, nod 阅读全文
posted @ 2024-03-19 15:42 YuKiCheng 阅读(16) 评论(0) 推荐(0)
摘要: 第一眼想到BFS,一次就AC了haha。 我的思路是用level记录当前是多少层,然后到最后一层的时候,将这一层的元素放到set集合里面。 输出的时候注意末尾不要有空格。 #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using n 阅读全文
posted @ 2024-03-19 11:31 YuKiCheng 阅读(21) 评论(0) 推荐(0)
摘要: 如果一个城市未被炸毁,那如果他可达的其他城市也未被炸毁,说明方案不可行。 #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; #define ll long long vector<vector< 阅读全文
posted @ 2024-03-19 10:27 YuKiCheng 阅读(14) 评论(0) 推荐(0)
摘要: 注意merge的时候如果p1和p2相等及时返回否则死循环了,代码有问题而不是算法超时。 #define _CRT_SECURE_NO_WARNINGS #include <bits/stdc++.h> using namespace std; #define ll long long int par 阅读全文
posted @ 2024-03-19 08:52 YuKiCheng 阅读(33) 评论(0) 推荐(0)
摘要: 老太太钻被窝,给爷整笑了。 测试点2: 颜色只能是k种,大于小于都过不去。 #include <bits/stdc++.h> using namespace std; int edges[503][503]; int color[503]; int main() { int v, e, k; cin 阅读全文
posted @ 2024-03-18 20:30 YuKiCheng 阅读(38) 评论(0) 推荐(0)
摘要: 这道题真的烦,输出想半天。 反正就是要区分奇偶,才能知道那个结点最后要打印出-1. 我看网上遇到的都是测试点3的问题,不过我有问题的是测试点1,前三个出问题就是节点数奇偶的问题。 #include <bits/stdc++.h> using namespace std; map<int, pair< 阅读全文
posted @ 2024-03-18 19:25 YuKiCheng 阅读(22) 评论(0) 推荐(0)
摘要: ...祖师爷也可能是得道者,这合理吗?(坑) #include <bits/stdc++.h> using namespace std; vector<vector<int>> a; map<int, double> dd; double tota = 0; int n;//人数 double z, 阅读全文
posted @ 2024-03-18 16:53 YuKiCheng 阅读(12) 评论(0) 推荐(0)
摘要: 参考自: http://www.manongjc.com/detail/28-gsdqaxrxcgnqqlv.html 有改动。 个人认为已经是这道题最好的解法了。 注意点为测试点四:(以标点符号打头的时候别忽略掉前面有空格) 输入: 1 ,dac 输出 ,dec AI: ,dec #include 阅读全文
posted @ 2024-03-18 14:54 YuKiCheng 阅读(394) 评论(0) 推荐(0)
摘要: 法一:(23分) 数组。有一个测试点会超时,每次第二层遍历是O(n)。 #include <bits/stdc++.h> using namespace std; int a[100010]; int main(){ int n,t,count=0; cin>>n; for(int i=0;i<n; 阅读全文
posted @ 2024-03-15 20:40 YuKiCheng 阅读(27) 评论(0) 推荐(0)
上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 17 下一页