题意:给若干个阻值为1的电阻,要得到阻值为a/b的电阻最少需要多少个. 思路:令a=mb+n,则a/b=m+n/b=m+1/(b/n),令f(a,b)表示得到a/b的电阻的答案,由f(a,b)=f(b,a),有: f(a,b)=a/b + f(a%b,b)=a/b+f(b,a%b) (1)由于将所有的电阻之间的关系改变一下,串联变成并联,并联变成串联,阻值变成之前的倒数,所以f(a,b)=f(b,a)成立. (2)现在再证一下:串联变成并联,并联变成串联,阻值变成之前的倒数.考虑任一个电路,一定…
Description Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resistance value. However, all Mike has is lots of identical resistors with unit resistance R0 = 1. Elements with othe…
A. Rational Resistance Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/343/problem/A Description Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certain resista…
C. Rational Resistance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certai…
C. Rational Resistance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike is building a time machine in his spare time. To finish the work, he needs a resistor with a certai…
http://http://codeforces.com/problemset/problem/343/A A. Rational Resistance time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike is building a time machine in his spare time.…
这次比赛出的题真是前所未有的水!只用了一小时零十分钟就过了前4道题,不过E题还是没有在比赛时做出来,今天上午我又把E题做了一遍,发现其实也很水.昨天晚上人品爆发,居然排到Rank 55,运气好的话没准能领到T-shirt.除此之外,锁上程序之后,看到一个人数组开小了,我还提交了一个大数据,成功Hack了一次,然后Room排名顿时升到第1. My submissions     # When Who Problem Lang Verdict Time Memory 4474604 Sep 15,…
A. Magnets 模拟. B. Simple Molecules 设12.13.23边的条数,列出三个等式,解即可. C. Rational Resistance 题目每次扩展的电阻之一是1Ω的,所以假设当前的电阻为\(\frac{a}{b}\)会变成\(\frac{a+b}{b}\)或\(\frac{a}{a+b}\),其实就是求gcd的过程. D. Alternating Current 若出现连续两个相同的符号,其实线的方向是不变的,最后就是转化成括号匹配. E. Read Time…
1229: Rational Resistance Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 8  Solved: 4 [id=1229" style="color:rgb(26,92,200); text-decoration:none">Submit][Status][Web Board] Description Mad scientist Mike is building a time machine in h…
poj1112 Team Them Up! 补图二分图+dp记录路径codeforces 256A Almost Arithmetical Progression dp或暴力 dp[i][j] = dp[j][last] + 1 ;codeforces 294C Shaass and Lights 组合 计算方法的优化codeforces 298C Parity Game 纯粹证明题,想法很好.codeforces 256D 还不会,很好的一个dppoj3417 Network LCA + 树形…