随笔分类 - 紫书之路
摘要: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 ...
阅读全文
摘要: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...
阅读全文
摘要: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...
阅读全文
摘要: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 ...
阅读全文
摘要: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(!...
阅读全文
摘要:首先没看懂XOR(于是百度了一下):异或,英文为exclusive OR,或缩写成xor。同时还有一个OR,于是一起看了一眼: 大意: 输入一个整数n,在1~n内,有多少对整数(a,b)满足GCD(a,b)== a XOR b。 看着这个脑中闪过暴力,因为 a ^ b = c, 则 a ^ c =
阅读全文
摘要: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(...
阅读全文
摘要: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; ...
阅读全文