2011年4月24日

poj 2437

摘要: 贪心水题。代码:#include<iostream>#include<fstream>using namespace std;long long n,L;struct e{ long long s,t;};e a[10001];int cmp(const void *a,const void *b){ return (*(e *)a).s-(*(e *)b).s;}void read(){// ifstream cin("in.txt"); long long i,j,k; cin>>n>>L; for(i=0;i<n; 阅读全文

posted @ 2011-04-24 18:04 宇宙吾心 阅读(236) 评论(0) 推荐(0)

poj 2431

摘要: 贪心代码:#include<iostream>#include<fstream>#include<queue>using namespace std;int n;typedef struct e{ int s,t; bool friend operator <(const e &a,const e &b){ return a.t<b.t; }}e;e a[10001];int cmp(const void *a,const void *b){ return (*(e*)a).s-(*(e*)b).s;}priority_queue 阅读全文

posted @ 2011-04-24 16:53 宇宙吾心 阅读(266) 评论(0) 推荐(0)

poj 2393

摘要: 贪心。代码:#include<iostream>#include<fstream>using namespace std;long long n;void read(){// ifstream cin("in.txt"); long long i,j,k,s,t,minn; long long ans=0; cin>>n>>k; cin>>s>>t; ans=s*t; minn=s; for(i=1;i<n;i++) { cin>>s>>t; minn=min(minn+k 阅读全文

posted @ 2011-04-24 15:51 宇宙吾心 阅读(288) 评论(0) 推荐(0)

poj 2376

摘要: 贪心。代码:#include<iostream>#include<fstream>using namespace std;struct e{ int s,t;};e a[25001];int n;int cmp(const void *a,const void *b){ return (*(e *)a).s-(*(e *)b).s;}void read(){// ifstream cin("in.txt"); int i,j,k,s,t,T; cin>>n>>T; for(i=0;i<n;i++) cin>> 阅读全文

posted @ 2011-04-24 15:39 宇宙吾心 阅读(367) 评论(0) 推荐(0)

导航