摘要:
本来是采用暴力的,后来搜索了一下才知道原来用欧拉函数,于是去搜索了欧拉函数,讲得很详细~不过函数的证明倒是没有推导。。。首先,prime的初始化,参考了百度百科:void init_prime(){ memset(prime,1,sizeof(prime)); prime[0] = pr... 阅读全文
2014年7月23日
摘要:
stack的应用 1 #include 2 #include 3 #include 4 using namespace std; 5 int goal[1005]; 6 int d[1005]; 7 stacks; 8 int main() 9 {10 freopen("input.txt"... 阅读全文
摘要:
set的应用 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 freopen("input.txt","r",stdin); 9 string s,s1;10 ... 阅读全文
摘要:
map的应用 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 int main() 7 { 8 freopen("input.txt","r",stdin); 9 mapballoons;10 ... 阅读全文
摘要:
并查集 简单题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] >= 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(i... 阅读全文
摘要:
并查集 简单题 1 #include 2 #include 3 #include 4 #define N 10000005 5 using namespace std; 6 int par[N]; 7 int M[N]; 8 int Find(int x) 9 {10 if(par[x... 阅读全文
摘要:
并查集 入门题 1 #include 2 #include 3 int par[1000]; 4 int Find(int x) 5 { 6 while(par[x] > 0) 7 x = par[x]; 8 return x; 9 }10 void Merge(in... 阅读全文
摘要:
暴力搜索 1 #include 2 3 struct node 4 { 5 int x; 6 int y; 7 }s[10000]; 8 int main() 9 {10 //freopen("input.txt","r",stdin);11 int a,b,n,n... 阅读全文