[CodeForces 344C Rational Resistance]YY,证明
题意:给若干个阻值为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)现在再证一下:串联变成并联,并联变成串联,阻值变成之前的倒数。考虑任一个电路,一定可以看成两个电路的并联或者两个电路的串联(题目保证了),先假设子问题成立,考虑原来的电路A和电路B,如果A和B串联,则R0=RA+RB,变成并联后R=1/(1/(1/RA)+1/(1/RB))=1/(RA+RB)=1/R0,如果A和B并联,则R=RA*RB/(RA+RB),变成串联后R=1/RA+1/RB=(RA+RB)/(RA*RB)=1/R0,由数学归纳法,所以结论成立
1 |
#include <map> |
[CodeForces 344C Rational Resistance]YY,证明的更多相关文章
- Codeforces 344C Rational Resistance
Description Mad scientist Mike is building a time machine in his spare time. To finish the work, he ...
- Codeforces Round #200 (Div. 1)A. Rational Resistance 数学
A. Rational Resistance Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/343 ...
- Codeforces Round #200 (Div. 2) C. Rational Resistance
C. Rational Resistance time limit per test 1 second memory limit per test 256 megabytes input standa ...
- codeforces 200 div2 C. Rational Resistance 思路题
C. Rational Resistance time limit per test 1 second memory limit per test 256 megabytes input standa ...
- codeforces343A A. Rational Resistance
http://http://codeforces.com/problemset/problem/343/A A. Rational Resistance time limit per test 1 s ...
- CodeForces Round 200 Div2
这次比赛出的题真是前所未有的水!只用了一小时零十分钟就过了前4道题,不过E题还是没有在比赛时做出来,今天上午我又把E题做了一遍,发现其实也很水.昨天晚上人品爆发,居然排到Rank 55,运气好的话没准 ...
- Codeforces Round #200 (Div. 1 + Div. 2)
A. Magnets 模拟. B. Simple Molecules 设12.13.23边的条数,列出三个等式,解即可. C. Rational Resistance 题目每次扩展的电阻之一是1Ω的, ...
- zzu--2014年11月16日月潭赛 B称号
1229: Rational Resistance Time Limit: 1 Sec Memory Limit: 128 MB Submit: 8 Solved: 4 [id=1229" ...
- OUC_OptKernel_oshixiaoxiliu_好题推荐
poj1112 Team Them Up! 补图二分图+dp记录路径codeforces 256A Almost Arithmetical Progression dp或暴力 dp[i][j] = d ...
随机推荐
- 65535与TCP连接数的关系测试结论
首先说结论: .是否有关系 .有关系 对于客户端 -.对于客户端来说,只有65535,因为根据TCP四元组的sport来说,sport只有16位,所以(2^16)-1是65535.也就是最多有6553 ...
- ROM定制开发教程-Android adb命令用法与实例解析
一.什么是ADB Android Debug Bridge(adb)是一个命令行工具,可让您与模拟器或连接的Android设备进行通信.您可以在android sdk / platform-tools ...
- Linux学习笔记(四)帮助命令
帮助命令 man info help --help man 英文原意:format and display the on-line manual pages 功能:显示联机帮助手册 语法:man 选项 ...
- java面试题(一年工作经验)的心得
看面试题 正常人第一步肯定都会看面试题,我也不例外,在看的过程中,我发现有些文章写的不错,对我帮助不小值得推荐,如下: Java面试题全集(上) 很多基础的东西,建议先看. 各大公司Java后端开发面 ...
- HTTPie:替代 Curl 和 Wget 的现代 HTTP 命令行客户端
HTTPie 工具是现代的 HTTP 命令行客户端,它能通过命令行界面与 Web 服务进行交互. -- Magesh Maruthamuthu 大多数时间我们会使用 curl 命令或是 wget 命令 ...
- thinkphp--create()方法
1.create方法可以对POST提交的数据进行处理(通过表中的字段名称与表单提交的名称对应关系自动封装数据实例),例如user表中有一个字段名叫"username",如果表单中有 ...
- js事件冒泡于事件捕获
事件冒泡 事件捕获指的是从document到触发事件的那个节点,即自上而下的去触发事件. 事件冒泡是自下而上(从最深节点开始,向上传播事件)的触发事件 //例子 <div id="pa ...
- VHD VHDX 区别
A Virtual hard disk is saved either with VHD or VHDX file extension. VHD is the older while VHDX is ...
- Elasticsearch系列---实现分布式锁
概要 Elasticsearch在文档更新时默认使用的是乐观锁方案,而Elasticsearch利用文档的一些create限制条件,也能达到悲观锁的效果,我们一起来看一看. 乐观锁与悲观锁 乐观锁 E ...
- 用百度AI平台接口实现OCR文字识别
目录 一.接入指南 1.注册 2.登录 3.创建应用 二.安装接口模型 三.编写python代码 四.识别结果 一.接入指南 若想利用百度AI开放平台进行软件开发,首先应成为百度AI开放平台的开发者. ...