2011年4月25日

poj 2545

摘要: 简单题代码:#include<iostream>#include<fstream>using namespace std;long long a[20001];long long solve(long long s,long long t){ if(s<t) return s; else return t;}void read(){// ifstream cin("in.txt"); long long i,j,k; long long p1,p2,p3,n1,n2,n3; cin>>p1>>p2>>p3&g 阅读全文

posted @ 2011-04-25 17:15 宇宙吾心 阅读(204) 评论(0) 推荐(0)

poj 3069

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

posted @ 2011-04-25 16:28 宇宙吾心 阅读(323) 评论(0) 推荐(0)

poj 3085

摘要: 水题。代码:#include<iostream>#include<fstream>using namespace std;void read(){// ifstream cin("in.txt"); int i,j,k; int n1,n2,n3,n4; cin>>k; for(i=1;i<=k;i++) { cin>>j; n1=j/25; j%=25; n2=j/10; j%=10; n3=j/5; j%=5; n4=j; printf("%d %d QUARTER(S), %d DIME(S), %d N 阅读全文

posted @ 2011-04-25 15:49 宇宙吾心 阅读(243) 评论(0) 推荐(0)

poj 2726

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

posted @ 2011-04-25 15:33 宇宙吾心 阅读(271) 评论(0) 推荐(0)

poj 2586

摘要: 贪心。代码:#include<iostream>#include<fstream>using namespace std;void read(){// ifstream cin("in.txt"); int i,j,k,s,t; while(cin>>s>>t) { t=-t; if(s*4+t<0) { if(10*s+2*t>0) cout<<10*s+2*t<<endl; else cout<<"Deficit"<<endl; } else 阅读全文

posted @ 2011-04-25 15:10 宇宙吾心 阅读(157) 评论(0) 推荐(0)

导航