LeeBlog

导航

2011年3月21日 #

HDU 2199 Can you solve this equation?

摘要: 这题开始差点把他做一元二次方程给解了,后面用到POW时才有感觉,后来想得好复杂,四元一次怎么解啊 ,最后好玩把0-100内所有的函数值全部打出来,竟发现左边的函数在0-100内是单调递增的,看到这儿各位该知道了吧,直接二分;还有判断循环要用函数值,不要用自变量,用自变量要精确到10的-6次方#include<stdio.h>#include<math.h>double x,y;double f( double x ){ return 8 * pow( x,4 ) + 7*x*x*x + 2*x*x + 3*x + 6;}int main( ){ int t; scanf 阅读全文

posted @ 2011-03-21 21:07 LeeBlog 阅读(171) 评论(0) 推荐(1) 编辑

hdu 3790 最短路径问题

摘要: 今天的这题有点悲剧,错就错在一个地方,在输入距离的时候,我把花费也考虑进去了,结果一只wa,没办法,看了大牛的代码才知道只要考虑距离;#include<stdio.h>int n,m,s,t;int inf = 0x7fffffff,des[1024],dis[1024],map[1024][1024];int co[1024],cost[1024][1024];void Dijkstra( ){ for( int i = 1; i <= n; ++i ) { dis[i] = co[i] = inf; des[i] = 0; } dis[s] = co[s] = 0; f 阅读全文

posted @ 2011-03-21 14:00 LeeBlog 阅读(605) 评论(0) 推荐(0) 编辑