- 博客(15)
- 资源 (3)
- 收藏
- 关注
原创 CodeForces - 934C
解题思路让我想起了 HDU6058#include<iostream> #include<cstdio> #include<cstring> using namespace std; const int maxn = 2000 + 10; int one[maxn], two[maxn]; int a[maxn]; int main(){ int n; ...
2018-04-30 20:39:12 202
原创 CodeForces - 95C 最短路
原来做的时候,做到最后忘了找不到要输出-1还是很粗心#include<queue> #include<cstdio> #include<vector> #include<cstring> #include<iostream> using namespace std; #define LL long long const int maxn ...
2018-04-30 17:35:11 290
原创 poj2492
#include<cstdio> #include<iostream> using namespace std; const int maxn = 10000 + 10; int p[maxn];///p 代表祖先 int sex[maxn];/// sex 代表性别 int tofind(int x){ if(p[x] == x) return x; ...
2018-04-28 21:41:46 211
原创 CodeForces - 699D
利用并查集判断环和树第一次两个节点判断是,如果不在一个树上就合并,如果出现两个点在一个树上就说明出现了环#include<iostream> #include<cstdio> using namespace std; const int maxn = 200000 + 10; int a[maxn], p[maxn]; int tofind(int x){ if(x...
2018-04-27 16:10:05 212
转载 玲珑学院1087
博弈题解类似题目的题解本题的题解#include<bits/stdc++.h> using namespace std; const int maxn=1<<21; int n,a[maxn]; int main() { int T;cin>>T; while (T--) { scanf("%d",&n); int k=0,sg=0,ans...
2018-04-23 21:22:04 194
原创 POJ 2524
并查集#include<cstdio> #include<iostream> #include<cstring> using namespace std; const int maxn = 50000 + 10; int p[maxn]; bool vis[maxn]; int tofind(int x){ if(x == p[x]) return p[...
2018-04-22 21:44:12 204
原创 UVALive - 5059
一眼看过去就是SG但是再看一眼数据范围,WC,打表的话数组开不到哇想啊想,想啊想,晚上刷题好痛苦呀,想不出来呀,一看题解,打表找规律,WC,这也可以,可是我懒啊,不懒的话也可以打表找一下打表找规律的话直接找板子稍微改一下就可以了,稍微改还不会,那就再好好看看SG吧总之规律是偶数 SG(n) = n >> 1奇数 SG(n) = SG(n>>1)然后当你知道了规律之后,你就开...
2018-04-22 21:20:46 238
原创 poj 1611
并查集入门一个社团的合并一次,最后统计和0是在相同集合的人#include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int maxn = 30000 + 10; int p[maxn]; int a[maxn]; int tofind(int x){ ...
2018-04-22 20:27:07 175
原创 CodeForces - 605A
每次可以把一辆车放在开头或者结尾问最少多少次操作让这个数列变成递增数列既然要保持最少操作,那就需要让最长的上升序列的数保持不变,让其他数进行改变#include <iostream> #include <cstdio> using namespace std; const int maxn = 100000 + 10; int a[maxn], b[maxn]; int m...
2018-04-17 21:37:48 248
原创 HDU 4925 找规律
找规律#include <iostream> #include <cstdio> #include <algorithm> #define LL long long using namespace std; int main(){ LL T, N, M; scanf("%lld", &T); while(T--){ ...
2018-04-17 20:42:26 522
原创 HDU 1087
DP#include<stdio.h> #include<algorithm> #include<string.h> using namespace std; int a[1005]; int dp[1005]; int main() { int n; int i, j; while (scanf("%d", &n) != EOF &&...
2018-04-14 16:57:31 156
原创 POJ 2253
floy 变形记最短路的又一种玩法#include <cstdio> #include <cstring> #include <string> #include <iostream> #include <stack> #include <queue> #include <vector> #include &
2018-04-14 16:55:03 119
原创 SGU 499
思路主要是枚举因子归为优美的暴力横向不通的时候,我们可以采用纵向枚举#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; const int maxn = 1000000 + 10; int ans[maxn...
2018-04-14 16:52:38 192
原创 HDU 6231 二分
看了第一眼,脑子里只有暴力第二眼还是暴力,果断暴力T一发然后开始想优化成nlogn,采用枚举A[]数组里面的数,当然是二分枚举两个坑点(xxxxx)XXXX(xxxxx)上面三个区间我们命名区间一,区间二,区间三假设区间三正好满足比枚举的数大且个数刚刚好的一个区间1. 计算区间的时候无脑区间一*区间三,果断WA,因为区间枚举出现了重复给一个12个数的数组 1 1 1 1 3 1 3 3 1 4 1...
2018-04-14 16:46:23 228
apche shiro漏洞检测和利用工具
2020-07-30
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人