afterward

导航

 

2012年8月1日

摘要: 先将田忌和国王的马都排序。若田忌赢了n场,用田忌的前n个赢一定是最优的。View Code #include<iostream>#include <algorithm>using namespace std;bool cmp(int x,int y){ return x>y;}int main(){ int x,n,i,j,k; n=0; int a[1005],b[1005];//a 田忌 ; b 国王; int s; while( cin>>x&&x) { for(i=0;i<x;i++) cin>>a[i]; s 阅读全文
posted @ 2012-08-01 22:10 afterward 阅读(535) 评论(0) 推荐(0) 编辑
 
摘要: 这个跟上次做的Flower很像,但我最先想到的是贪心。变形的找多个范围的含这个数的范围有多少个。把每条竖着的走廊看做一个单位,占用的次数记录,找出最大值。想不到这点真的很难做啊。View Code #include<stdio.h>#include<string.h>int main(){ int i,j,n,t,p,q,max,tmp; int a[205]; scanf("%d",&t); while(t--) { scanf("%d",&n); memset(a,0,size... 阅读全文
posted @ 2012-08-01 11:18 afterward 阅读(242) 评论(0) 推荐(0) 编辑
 
摘要: 先展示一个我同学些的代码,超级goodView Code #include<iostream>#include<cstdio>#include<cstring>using namespace std;int C[150005];int B[150005];//int Out[150005];int N=150005;int Lowbit(int x){ return x&(-x);}void Modify(int i,int x){ while(i>0) { cout<<i<<" : "<< 阅读全文
posted @ 2012-08-01 09:34 afterward 阅读(359) 评论(1) 推荐(0) 编辑