- 博客(10)
- 资源 (1)
- 收藏
- 关注
原创 poj1077
//1.广搜,参考网址:http://www.cnblogs.com/jackge/archive/2013/03/28/2986804.html 本来是想用数组实现队列的但是mle了///于是改着改着就和网上的一样了。。。#include #include #include #include #include #include #include using namespace st
2016-03-30 09:49:19 279
原创 紫书习题4-2
#include #include #include #include using namespace std;int H[10][10],V[10][10],ans[10];int judge(int x,int y,int len){ int i; for(i=y;i<=y+len-1;i++) { if(!H[x][i])return
2016-03-25 17:16:17 306
原创 uva 1103 紫书例题6-13(dfs)
#include #include #include #include using namespace std;int grid[201][201],m,n,flag,vis[201][201];int mov[4][2]={{0,1},{0,-1},{1,0},{-1,0}};char r[6]={'W','A','K','J','S','D'};bool cmp(char a
2016-03-19 12:52:41 398
原创 poj2478 欧拉函数
#include #include #include using namespace std;const int N=1000005;long long eu[N],ans[N];void eular(){ int i,j; for(i=2;i<N;i++) if(!eu[i]) { for(j=i;j<N;j
2016-03-15 23:29:08 317
原创 紫书习题5-6 uva1595
#include #include #include using namespace std;struct node{ int x,y;}s[1001];bool cmp1(node x1,node y1){ if(x1.x==y1.x)return x1.y<y1.y; return x1.x<y1.x;}bool cmp2(node x1,no
2016-03-09 09:51:18 570
原创 poj 2785 二分或者hash
4 Values whose Sum is 0Time Limit: 15000MSMemory Limit: 228000KTotal Submissions: 18896Accepted: 5619Case Time Limit: 5000MSDescriptionThe SUM problem can
2016-03-08 21:49:43 288
原创 紫书 p120 第五章例题5-7 丑数
#include #include #include #include using namespace std;long long record[3]={2,3,5};priority_queue,greater > pq;set s;int main(){ long long i,t,x,j; pq.push(1); s.insert(1);
2016-03-03 19:09:32 360
原创 紫书 p108 例题5-1
lower_bound(a,a+n,x):查找“大于或等于x的第一个元素”调用lower_bound之前必须确定序列为有序序列,否则调用出错。返回一个迭代器。sort,可以是普通数组sort(a,a+n);vector:sort(v.begin(),v.end())#include #include using namespace std;const int maxn=10000;
2016-03-01 23:19:04 373
原创 紫书 p59 习题3-8
循环的地方就是余数重复出现的地方,这个不难想。用数组记录余数是否出现过。。出现一次就加1,这种方法以前见过的。。,就是电话号码那道题,但是一开始还是只想到记录下来每次的余数然后用循环来找这个余数有没有出现过,看了别人思路的提示才知道。。用数组这种思路不是很难想,以前也用这种方法做过,只是第一次是担心数组开太大才没用==恩。。以后注意就是这道题之后才知道为什么分数一定是有理数。。。。以前都没想过
2016-03-01 21:53:34 369
原创 紫书 p58 3-7
#include #include #include using namespace std;int main(){ int T,i,j,m,n,b[1001][4],max,r[1001],r2; char a[51][1001]; scanf("%d",&T); while(T--) { memset(b,0,sizeof(b
2016-03-01 09:24:39 327
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人