上一页 1 2 3 4 5 6 7 8 9 10 ··· 50 下一页
摘要: 最小生成树: 畅通工程 HDU - 1232 只要互相间接通过道路可达即可,说明只要最后是一棵树就可以. 树的边数为顶点数减1. 用并查集求出当前已有的边数, 再用 n-1减去就是还需要再建的路. 1 #include<cstdio> 2 #include<iostream> 3 #include< 阅读全文
posted @ 2017-11-07 23:21 yijiull 阅读(205) 评论(0) 推荐(0) 编辑
摘要: (orz从之前从来没见过这种题 Xor Sum HDU - 4825 模板~ Xor Sum HDU - 4825 Xor Sum 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define LL long long 4 const int 阅读全文
posted @ 2017-11-01 19:38 yijiull 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 补几道异或的题~ 链接: here 题解: 求前缀异或和(?) 然后按统计1的个数cnt,显然只有1和配对的区间才能使得最后的值为1, 于是贡献度为 (n - cnt) * cnt + cnt, 再乘上该位的权 1<<pos 1 #include <bits/stdc++.h> 2 using na 阅读全文
posted @ 2017-11-01 18:09 yijiull 阅读(170) 评论(0) 推荐(0) 编辑
摘要: A. Short Program 很巧妙的处理方式,用0和1023来记录 1 #include <bits/stdc++.h> 2 using namespace std; 3 4 int main(){ 5 int n; 6 scanf("%d", &n); 7 char s[3]; 8 int 阅读全文
posted @ 2017-10-31 22:58 yijiull 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 1 #include <bits/stdc++.h> 2 using namespace std; 3 //康托展开求法: 4 //比如2143 这个数,求其展开: 5 //从头判断,至尾结束, 6 //① 比 2(第一位数)小的数有多少个->1个就是1,1*3! 7 //② 比 1(第二位数)小的 阅读全文
posted @ 2017-10-27 22:32 yijiull 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 链接:here Car HDU - 5935 精度问题有点迷。。。 不知道为什么用ceil就是过不了。。。 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define LL long long 4 const int maxn = 1000 阅读全文
posted @ 2017-10-27 21:22 yijiull 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Triangle POJ - 2079 求最大三角形 旋转卡壳 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <iostream> 5 #include <cmath> 6 using names 阅读全文
posted @ 2017-10-26 20:55 yijiull 阅读(155) 评论(0) 推荐(0) 编辑
摘要: CF877 链接 D. Olya and Energy Drinks bfs 1 #include <bits/stdc++.h> 2 using namespace std; 3 const int maxn =1010; 4 5 char mp[maxn][maxn]; 6 int vis[ma 阅读全文
posted @ 2017-10-25 18:22 yijiull 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 1 //SG函数打表 2 const int MAX_DIG = 64; 3 4 // SG打表 5 // f[]:可以取走的石子个数 6 // sg[]:0~n的SG函数值 7 // hash[]:mex{} 8 int f[MAX_DIG]; 9 int sg[MAX_DIG]; 10 int 阅读全文
posted @ 2017-10-24 22:35 yijiull 阅读(93) 评论(0) 推荐(0) 编辑
摘要: Modules 题目链接:here 朱刘算法 1 #include <bits/stdc++.h> 2 using namespace std; 3 #define LL long long 4 const int inf = 0x3f3f3f3f; 5 const int maxn = 3010; 阅读全文
posted @ 2017-10-24 07:21 yijiull 阅读(144) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 50 下一页