LeeBlog

导航

2011年3月3日 #

ipod为什么那么贵

摘要: 苹果的东西之所以如此贵,首先当然是品牌打得响,二是他的做工精细,漂亮,超薄,让人爱不释手,当然这些只是我们看到的表面原因,实际上还与它的背后有关,苹果的员工多数在美国,研发成本比较高。他们的工作条件在it企业数一数二,工资也很高,这都是苹果的东西很贵的主要原因。而且苹果的产品在全世界实行同价制度,但微软这样的企业把在中国发售的产品价格压低了一些,因为中国的消费水平不是太高。本观点取自百度知道 阅读全文

posted @ 2011-03-03 15:08 LeeBlog 阅读(394) 评论(0) 推荐(1) 编辑

2011年3月2日 #

hdu 1102 Constructing Roads

摘要: 此题是最小生成树的基础题#include<stdio.h>#include<string.h>#include<stdlib.h>int set[124],n,t,a,b,c;long long min;struct map{ int x,y,val;}m[ 100000 ];int cmp( const void *a,const void *b ){ return ( ( map * ) a ) -> val - ( ( map * ) b ) -> val;}int find( int i ){ return set[ i ] == i ? 阅读全文

posted @ 2011-03-02 19:48 LeeBlog 阅读(156) 评论(0) 推荐(0) 编辑

2011年3月1日 #

hdu 1181 变形课

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>int len,map[26][ 26 ],des[26],a,b,f = 0,m;char ch[1000];void DFS( int n ){ if( f ) return ; if( n == 'm' - 'a' ) { f = 1; return; } for( int i = 0; i < 26 ; ++i ) { if( n != i && map[n][i] == 1 ) { if( 阅读全文

posted @ 2011-03-01 22:40 LeeBlog 阅读(205) 评论(0) 推荐(0) 编辑

hdu 1509

摘要: #include<stdio.h>#include<string.h>struct E{ char name[1000]; char less[1000]; int d; int num; }e[60024];int c = 0,max = 0,count = 0;void swap( int x,int y ){ struct E t; t = e[ x ]; e[ x ] = e[ y ]; e[ y ] = t; }int cmp( int x,int y ){ if( e[ x ].d == e[ y ].d ) if( e[x].num < e[y].n 阅读全文

posted @ 2011-03-01 17:23 LeeBlog 阅读(374) 评论(0) 推荐(0) 编辑

2011年2月27日 #

hdu 1875 畅通工程再续

摘要: 这是我第二次敲这个题,没想到果断悲剧了,最后只能翻出以前的代码,没想到是qsort出问题了,以后qsort全部用问号表达式,不再用a-b了.#include<stdio.h>#include<math.h>#include<stdlib.h>int set[105],t,c,m;double sum = 0;struct e{ int x,y; double v;}val[10000];struct coor{ int x,y;}co[105];int cmp( const void *a,const void *b ){ return ((e *)a) - 阅读全文

posted @ 2011-02-27 19:45 LeeBlog 阅读(361) 评论(0) 推荐(0) 编辑

2011年2月26日 #

hdu 1856 More is better

摘要: 这题分为四个步骤 压缩,合并完全,压缩查找最大集合include<stdio.h>int set[10000000],count[10000000];int find( int x ){ return set[ x ] == x ? x : set[ x ] = find( set[ x ] );} void merge( int x,int y ){ int a = find( x ),b = find( y ); set[ a ] = b; }int main( ){ int n,i,a,b; while( scanf( "%d",&n ) !=EO 阅读全文

posted @ 2011-02-26 09:55 LeeBlog 阅读(154) 评论(0) 推荐(0) 编辑

hdu 1213 How Many Tables

摘要: 并查集基础#include<stdio.h>int set[100000];int find( int i ){ return set[ i ] == i ? i : set[ i ] = find( set[ i ] );//路径压缩}//查找跟结点void merge( int x,int y ){ int a = find( x ), b = find( y ); if( a != b ) set[ a ] = b;//合并 }int main( ){ int T,n,m,a,b; scanf( "%d",&T ); while( T-- ) { 阅读全文

posted @ 2011-02-26 09:48 LeeBlog 阅读(133) 评论(0) 推荐(0) 编辑

hdu 1232 畅通工程

摘要: 这题就是把所有的村庄看它们是否畅通来分成n个集合,然后只要修建 n - 1 条道路就可以把他们连起来了#include<stdio.h>int set[ 1024 ];int find( int i ){ return set[ i ] == i ? i : set[ i ] = find( set[ i ] );}void merge( int x, int y ){ int a = find( x ),b = find( y ); set[ a ] = b; }int main( ){ int n,m,a,b; while( scanf( "%d",& 阅读全文

posted @ 2011-02-26 09:39 LeeBlog 阅读(165) 评论(0) 推荐(0) 编辑

hdu 1863 畅通工程

摘要: 这题是刚学最小生成树的一入门题,其实就是求最小生成树,用结构体定义这棵树,到时候便于权值排序,输入后进行排序,让后再讲这些顶点连成一个集合,并在这过程中把各权值相加(因为这些权值已按递增排列,所以得出的集合时权值最小的),至于是否能保证畅通则只要看有几个根结点就可以了#include<stdio.h>#include<stdlib.h>#include<string.h>int set[1000],n,m,x,y,val;struct Ed{ int x,y,val; }e[10000];int cmp( const void *a,const void * 阅读全文

posted @ 2011-02-26 09:34 LeeBlog 阅读(212) 评论(0) 推荐(0) 编辑

2011年2月24日 #

hdu 2028 Lowest Common Multiple Plus 求最小公倍数

摘要: 此题思路较简单,经多方分析后可得,两数的最小公倍数即为两数之积除以两数的最大公约数( 可用辗转相除法做,这里偷了以下懒),此题我采用的方法是先求两个两个一求,最后全部求出,还有记得用64位存贮,不然会WA的……#include<stdio.h>void cal( int n ){ long long a,i,b = 1; while( n-- ) { scanf( "%I64d",&a ); for( i = a < b ? a : b;; --i ) { if( a % i == 0 && b % i == 0 ) break; 阅读全文

posted @ 2011-02-24 16:44 LeeBlog 阅读(347) 评论(0) 推荐(0) 编辑