摘要: http://ac.jobdu.com/problem.php?id=1399View Code 1 #include<iostream> 2 #include<algorithm> 3 #include<cstdio> 4 #include<cmath> 5 using namespace std; 6 struct node 7 { 8 int w,v;//这里改成double 会超时 9 };10 node item[100008];11 bool cmp(const node &a,const node &b)12 {13 阅读全文
posted @ 2012-03-28 21:48 keepmoving89 阅读(271) 评论(1) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1420View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cmath> 4 #include<cstdlib> 5 using namespace std; 6 int main() 7 { 8 int n; 9 while(cin>>n)10 {11 int *a=new int[n];12 int i,j,sum=0;13 for(i=0;i<n;i++) cin>>a[ 阅读全文
posted @ 2012-03-28 19:50 keepmoving89 阅读(227) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1335View Code 1 /*宽度搜索,注意对于宽度搜索树中 ,第几层的记录, 2 层数即是最短步数*/ 3 #include<iostream> 4 #include<cstdio> 5 #include<queue> 6 using namespace std; 7 class node 8 { 9 public: node(int x1,int y1,int deep1)10 {11 x=x1;12 y=y1;13 deep=deep1;14 }15 ... 阅读全文
posted @ 2012-03-28 19:47 keepmoving89 阅读(360) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1402 用map超时了View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<bitset> 5 #include<climits> 6 using namespace std; 7 int main() 8 { 9 bitset<1000008>b1,b2;//放到main外面,编译通不过? 10 int n,x,i;11 while(scanf 阅读全文
posted @ 2012-03-28 17:20 keepmoving89 阅读(236) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1346View Code 1 #include<iostream> 2 #include<cstring> 3 #include<algorithm> 4 #include<cmath> 5 using namespace std; 6 typedef struct node 7 { 8 int id,score; 9 };10 node a[1008];11 int n,m;12 bool cmp(const node &a,const node &b)13 阅读全文
posted @ 2012-03-28 16:00 keepmoving89 阅读(172) 评论(0) 推荐(0) 编辑
摘要: http://ac.jobdu.com/problem.php?id=1380View Code 1 /*每个正数都是一个32位二进制串,只有一个lucky number 2 lucky出现m%n次,其他为n次,如果没有lucky,序列中个位为0的整数和 3 都是n的整数倍,lucky出现m%n次,统计序列中1的整数的个数,假设为C 4 若C%n==0 luck的个位为0,否则C%n一定为m%n,且luck个位为1 5 其它位跟给位一样*/ 6 #include<iostream> 7 #include<cstring> 8 #include<cstdio> 阅读全文
posted @ 2012-03-28 12:42 keepmoving89 阅读(472) 评论(0) 推荐(0) 编辑