随笔分类 -  贪心

摘要:#include <stdio.h>#include <stdlib.h>struct node{ int c; int d;}nodes[100010];int cmp(const void * a,const void * b){ return (*(node *)a).d-(*(node *)b).d;}int main(){ int t,n,i,k=1; __int64 max,sum; scanf("%d",&t); while(t--) { max=0; sum=0; scanf("%d",&n); f 阅读全文
posted @ 2012-04-27 21:13 shijiwomen 阅读(190) 评论(0) 推荐(0)
摘要:本题要注意贪心的标准比较,要将除法改成乘法,注意细节,妙啊#include <stdio.h>#include <iostream>using namespace std;int main(){ int m,n,i,j,a[1000][2]; while(scanf("%d%d",&m,&n),m!=-1&&n!=-1) { for(i=0;i<n;i++) scanf("%d%d",&a[i][0],&a[i][1]); for(i=0;i<n-1;i++) { for 阅读全文
posted @ 2012-03-30 09:19 shijiwomen 阅读(200) 评论(0) 推荐(0)