上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 42 下一页
摘要: 题意: bfs:从1,1,1到a,b,c的最短时间View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<queue> 5 #include<algorithm> 6 using namespace std; 7 const int maxn = 55; 8 const int inf = 9999999; 9 int mat[ maxn ][ maxn ][ maxn ];10 const int dx[6]={0,-1,0 阅读全文
posted @ 2013-01-27 15:42 xxx0624 阅读(441) 评论(0) 推荐(0) 编辑
摘要: 转化为求给定的函数与X轴的交点二分即可View Code 1 #include<stdio.h> 2 #include<math.h> 3 4 double func( double x,double y ){ 5 double ans; 6 ans=8*pow( x,4.0 )+7*pow( x,3.0 )+2*pow( x,2.0 )+3*x+6.0-y; 7 return ans; 8 } 9 int judge( double y ){10 double t1,t2;11 t1=func( 0,y ),t2=func( 100,y );12 ... 阅读全文
posted @ 2013-01-27 15:00 xxx0624 阅读(287) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<stdio.h> 2 #include<math.h> 3 4 double func( double x,double y ){ 5 double ans; 6 ans=6*pow( x,7.0 )+8*pow( x,6.0 )+7*pow( x,3.0 )+5*pow( x,2.0 )-y*x; 7 return ans; 8 } 9 10 int main(){11 int T;12 scanf("%d",&T);13 while( T-- ){14 double y;15 ... 阅读全文
posted @ 2013-01-27 14:46 xxx0624 阅读(347) 评论(0) 推荐(0) 编辑
摘要: 题意:由题意给出的函数,求出最小值的x方法一先求导,导数等于0的位置就是F(x)最小的位置( 仅限此题)View Code 1 #include<stdio.h> 2 #include<math.h> 3 4 double func( double x,double y ){ 5 double ans; 6 ans=42.0*pow( x,6.0 )+48.0*pow( x,5.0 )+21.0*x*x+10.0*x-y; 7 return ans; 8 } 9 10 double func2( double x,double y ){11 double a... 阅读全文
posted @ 2013-01-27 14:36 xxx0624 阅读(219) 评论(0) 推荐(0) 编辑
摘要: 简单的模拟。注意:在计算牛奶的平均价格时候,牛奶的体积必须是200的倍数且不比1000大。a[ i ].before 存的是原体积View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<stdlib.h> 4 #include<algorithm> 5 using namespace std; 6 const int maxn = 105; 7 struct node{ 8 int price; 9 int v,before;10 double per;11 int ok;12 阅读全文
posted @ 2013-01-25 15:27 xxx0624 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 大数相乘sum中,高位在前,所以两个乘数必须先转换一下,即末位在前,依此类推。View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int maxn = 505; 4 char a[ maxn ],b[ maxn ]; 5 int sum[ maxn*2 ]; 6 void change ( int lena,int lenb ){ 7 int k=0; 8 char tmp[ maxn ]; 9 for( int i=lena-1;i>=0;i-- )10 tmp[ k++ ]=a[ i... 阅读全文
posted @ 2013-01-21 14:43 xxx0624 阅读(422) 评论(0) 推荐(0) 编辑
摘要: 水~题意:求一个数的各个位置上的和,这个和是只有一位的View Code 1 #include<stdio.h> 2 #include<string.h> 3 const int maxn = 1005; 4 char a[ maxn ]; 5 int main(){ 6 while( scanf("%s",a)!=EOF ){ 7 if( strcmp(a,"0")==0 ) break; 8 int len; 9 len=strlen( a );10 int ans=0;11 for( int i=0... 阅读全文
posted @ 2013-01-20 21:20 xxx0624 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 题意:给定一些点,一些边。找出最长的一条路。点可重复走。简单的dfsView Code 1 #include<stdio.h> 2 #include<string.h> 3 const int maxn = 105; 4 int mat[ maxn ][ maxn ],vis[ maxn ][ maxn ]; 5 int max( int i,int j ){ 6 if( i<j ) i=j; 7 return i; 8 } 9 int ans;10 11 void dfs( int pos,int sum,int n ){12 if( pos>=n ) r 阅读全文
posted @ 2012-12-29 00:11 xxx0624 阅读(281) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include 2 #include 3 #include 4 using namespace std; 5 const int maxn = 305; 6 int dp[ maxn ][ maxn ]; 7 char a[ maxn ],b[ maxn ]; 8 int same( int i,int j ){ 9 if( a[ i ]==b[ j ] ) return 1;10 return 0;11 }12 int fmax( int i,int j,int k ){13 if( i<j )i=j;14 if( i<k )i=k... 阅读全文
posted @ 2012-12-27 21:33 xxx0624 阅读(170) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include 2 #include 3 #include 4 #define maxn 505 5 using namespace std; 6 int dp[ maxn ][ maxn ]; 7 int main(){ 8 char str1[ maxn ],str2[ maxn ]; 9 //string str1,str2;10 while ( scanf("%s%s",str1,str2)!=EOF ) {11 int len1,len2;12 len1 = strlen( str1 );... 阅读全文
posted @ 2012-12-23 18:38 xxx0624 阅读(240) 评论(0) 推荐(0) 编辑
上一页 1 ··· 28 29 30 31 32 33 34 35 36 ··· 42 下一页