上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 80 下一页
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1713输入 a/b c/d转换后变成:(a*d)/(b*d) 和 (c*b)/(b*d)按照题意,就是在转相同的圈子(b*d圈)时,各自需要时间a*d和c*b.所以,这里把a*b与c*b的最小公倍数求出来就可以了。这样。求出的最小公倍数lcm再除以(b*d)就是所求的周期。(http://www.wutianqi.com/)但是,这里要求若无法整出,则写出分数形式,这时,就可以求lcm与(b*d)的最大公约数gcd,求出gcd后与(b*d)比较,若相等,则证明可以整除~~~~1#include<cstd 阅读全文
posted @ 2011-05-08 10:15 yansirfuture 阅读(552) 评论(2) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2093#include<cstdio>#include<cstdlib>#include<cstring>#defineMAX1000typedefstruct{charname[11];intsum;inttotal;}credit;intcmp(constvoid*a,constvoid*b){if((*(credit*)a).total!=(*(credit*)b).total)return(*(credit*)a).total-(*(credit*)b).total 阅读全文
posted @ 2011-05-07 22:51 yansirfuture 阅读(231) 评论(0) 推荐(0)
上一页 1 ··· 15 16 17 18 19 20 21 22 23 ··· 80 下一页