LeeBlog

导航

2011年4月30日 #

HDU 2041 超级楼梯

摘要: 这题就是一个递推的关系,不过还有一种数学方法递推#include<stdio.h>int num[45];void chart( ){ num[0] = 1,num[1] = 2; for( int i = 2; i < 45; ++i ) { num[i] = num[i-1] + num[i-2]; } }int main( ){ chart( ); int t,n; scanf( "%d",&t ); while( t--&&scanf( "%d",&n ) ) printf( "%d\n 阅读全文

posted @ 2011-04-30 21:08 LeeBlog 阅读(695) 评论(0) 推荐(0) 编辑

HDU 1879 继续畅通工程

摘要: 跟畅通工程差不多,我的代码就在那上面改的#include<stdio.h>#include<stdlib.h>struct e{ int x,y,v;}val[10500];int n,m,set[105],sum;int cmp( const void *a,const void *b ){ return ( ( e * )a ) -> v - ( ( e * )b ) -> v;}int find( int i ){ return i == set[i] ? i :set[i] = find( set[i] );}void Kustra( ){ for( 阅读全文

posted @ 2011-04-30 09:02 LeeBlog 阅读(150) 评论(0) 推荐(0) 编辑