摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1034 模拟题View Code 1 #include<iostream> 2 using namespace std; 3 int a[100000]; 4 int b[100000];//a的一半 5 int n; 6 int main() 7 { 8 while(cin>>n && n) 9 {10 int i;11 for(i=0;i<n;i++) cin>>a[i];12 int num=0;13 ... 阅读全文
posted @ 2012-03-30 23:14 keepmoving89 阅读(174) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1325 并查集View Code 1 #include<iostream> 2 using namespace std; 3 struct node 4 { 5 int x,y; 6 }; 7 node edge[1000008];//edge 8 int father[1008]; 9 int n,m,k;10 void initSet()11 {12 for(int i=0;i<=n;i++) father[i]=i;13 }14 int find(int x)15 {16 int i=x,temp. 阅读全文
posted @ 2012-03-30 19:34 keepmoving89 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 阅读全文
posted @ 2012-03-30 16:10 keepmoving89 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1016大数相加原理View Code 1 /*大数相加原理*/ 2 #include<iostream> 3 #include<vector> 4 #include<cmath> 5 #include<cstring> 6 #include<algorithm> 7 #include<cstdlib> 8 using namespace std; 9 vector<int>prime; 10 vector<int>v1;// 1 阅读全文
posted @ 2012-03-30 11:20 keepmoving89 阅读(246) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1032 简单模拟View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<iostream> 4 using namespace std; 5 int getnum(long long n) 6 { 7 int num=1; 8 while(n!=1) 9 {10 if(n&1) n=3*n+1;11 else n/=2;12 num++;13 }14 retur... 阅读全文
posted @ 2012-03-30 10:21 keepmoving89 阅读(131) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1398 注意可能有多个最大最小值,找出最左的最小值和最右的最大值即可,用cout超时View Code 1 #include<iostream> 2 #include<climits> 3 #include<cstdio> 4 using namespace std; 5 int a[208]; 6 int main() 7 { 8 int n; 9 while(scanf("%d",&n)==1)10 {11 int i;12 for(i=0;i<n; 阅读全文
posted @ 2012-03-30 09:30 keepmoving89 阅读(145) 评论(0) 推荐(0) 编辑