随笔分类 -  紫书之路

摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 20000 + 5; 7 int fa[maxn]; 8 int d[maxn]; 9 10 int Find(int x){ 11 if (fa[x] != x){ 12 int root ... 阅读全文
posted @ 2017-11-10 18:36 ouyang_wsgwz 阅读(176) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 using namespace std; 4 const int maxn = 100000 + 10; 5 int fa[maxn]; 6 7 int Find(int x){ 8 if (x == fa[x]) 9 return x; 10 else 11 return f... 阅读全文
posted @ 2017-11-10 18:18 ouyang_wsgwz 阅读(198) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int maxn = 105; 7 char s[maxn]; 8 int cnt0, cnt1, cnt2, cnt3; 9 10 int main() 11 { 12 while (scanf("%s", s + 1) != EOF... 阅读全文
posted @ 2017-10-20 21:35 ouyang_wsgwz 阅读(199) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 using namespace std; 4 int k, cnt; 5 char G[2][6][5], ans[6]; 6 bool dfs(int col){ 7 if (col == 5){ 8 if (++cnt == k){ 9 ans[col] = '\0'; 10 ... 阅读全文
posted @ 2017-10-20 21:04 ouyang_wsgwz 阅读(759) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 #define N 50010 4 int phi[N],n,sum[N]; 5 void phi_table() 6 { 7 int i,j; 8 memset(phi,0,sizeof(phi)); 9 phi[1]=1; 10 for(i=2;i<=N;i++) 11 if(!... 阅读全文
posted @ 2017-10-16 19:08 ouyang_wsgwz 阅读(426) 评论(0) 推荐(0) 编辑
摘要:首先没看懂XOR(于是百度了一下):异或,英文为exclusive OR,或缩写成xor。同时还有一个OR,于是一起看了一眼: 大意: 输入一个整数n,在1~n内,有多少对整数(a,b)满足GCD(a,b)== a XOR b。 看着这个脑中闪过暴力,因为 a ^ b = c, 则 a ^ c = 阅读全文
posted @ 2017-10-11 21:11 ouyang_wsgwz 阅读(210) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 const int maxn = 110; 7 long long f[maxn], ccount; 8 9 void init(long long n){ 10 long long m = (long long)sqrt(... 阅读全文
posted @ 2017-10-10 20:51 ouyang_wsgwz 阅读(203) 评论(0) 推荐(0) 编辑
摘要:1 #include 2 #include 3 #include 4 #include 5 #include 6 #define ll unsigned long long 7 using namespace std; 8 9 ll qmod(ll a, ll b, ll mod) 10 { 11 ll ans = 1; 12 a = a%mod; ... 阅读全文
posted @ 2017-09-26 21:55 ouyang_wsgwz 阅读(200) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示
深色
回顶
展开