2014年1月12日

ZOJ 3149 Breadtree DP

摘要: --------------------const int maxn=100000;const int maxm=10000;const LL LIM=1234567890LL;LL n,k;LL f[maxn];LL sum[maxn];int main(){ while (cin>>n>>k){ if (n==0) break; if (k==0) coutLIM) break; } cout<<ans<<endl; } } return 0;}-------------------- 阅读全文

posted @ 2014-01-12 22:30 电子幼体 阅读(138) 评论(0) 推荐(0) 编辑

ZOJ 3279 Ants 二分树状数组

摘要: ----------const int maxn=110000;const int maxm=10000;int n,m;struct BIT{ int n; int tree[maxn]; void init(int n){ this->n=n; memset(tree,0,sizeof(tree)); } int lowbit(int x){ return x&(-x); } void add(int x,int val){ for (int i=x;i0;i-=lowbit(i)) ret+... 阅读全文

posted @ 2014-01-12 20:38 电子幼体 阅读(123) 评论(0) 推荐(0) 编辑

URAL 1039 Anniversary Party 树形dp

摘要: -----------const int maxn=10000;const int maxm=110000;int n;struct EdgeNode{ int to,next;}edges[maxm];int head[maxn],edge;void init(){ memset(head,-1,sizeof(head)); edge=0;}void addedge(int u,int v){ edges[edge].to=v,edges[edge].next=head[u],head[u]=edge++;}int a[maxn];int f[maxn][2];int... 阅读全文

posted @ 2014-01-12 18:37 电子幼体 阅读(118) 评论(0) 推荐(0) 编辑

ZOJ 3278 8G Island 二分+二分

摘要: 第K大,不是第K小啊 (╯‵□′)╯︵┻━┻----------int n,m;LL K;LL a[maxn],b[maxn];bool C(LL x){ LL res=0; for (int i=1;i=x){ ans=mid; l=mid+1; } else r=mid-1; } res+=ans; } return res>=K;}int main(){ while (cin>>n>>m>>K){ for (int... 阅读全文

posted @ 2014-01-12 17:42 电子幼体 阅读(121) 评论(0) 推荐(0) 编辑

导航