题目大意:给定n个点,一些点之间有电阻相连,求1~n的等效电阻
首先我们设电流为1A 终点电势为零 点i的电势为Ui
由于电流是流 显然对于每个点(点1和点n除外) 有总流入等于总流出 即
Σ(Ui-Uj)/Rij=0 (i!=1,i!=n)
Σ(U1-Uj)/R1j=1
Σ(Un-Uj)/Rnj=-1
Un=0
联立方程组高斯消元即可 最后输出点1的电势就是答案
注意自环要无...
分类:
其他好文 时间:
2014-12-03 21:17:43
阅读次数:
152
1.程序入口
// create the application instance
AppDelegate app;
return Application::getInstance()->run();2.主循环
int Application::run():
while(!glview->windowShouldClose())
{
...
分类:
其他好文 时间:
2014-12-03 21:17:16
阅读次数:
175
本文将使用上篇文章介绍的Scroller类来完成一个比较常见的效果——滑动删除效果。
代码如下:
simpleSwipeListView:
package cn.edu.chd.simpleswipelistview;
import android.content.Context;
import android.util.AttributeSet;
import android....
分类:
移动开发 时间:
2014-12-03 21:16:15
阅读次数:
211
又是一个八皇后问题:
Given an integer n, return all distinct solutions to the n-queens puzzle.
Each solution contains a distinct board configuration of the n-queens' placement, where 'Q' and '.' both
...
分类:
其他好文 时间:
2014-12-03 21:17:08
阅读次数:
175
提到闭包总给人很高深的感觉,网上的例子也数不胜数。但是我发现相当一部分并不容易理解。根据我的观察,是因为这些例子把标题中提到的概念糅杂在了一起,往往越看越糊涂。所以我希望化整为零,拆成简单例子来解释。
1.先看作用域:
JavaScript作用域只有两种——全局作用域和函数内作用域,没有代码块作用域。示例:
function loop(){
for(var i=0;i
/...
分类:
编程语言 时间:
2014-12-03 21:15:18
阅读次数:
132
Given a binary tree struct TreeLinkNode { TreeLinkNode *left; TreeLinkNode *right; TreeLinkNode *next; }Populate each next pointe...
分类:
其他好文 时间:
2014-12-03 21:16:33
阅读次数:
139
Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is formed from the orig...
分类:
其他好文 时间:
2014-12-03 21:16:44
阅读次数:
172
如何在博客园上面显示自己的头像1、打开你的博客主页:点击【管理】,如图:2、点击【设置】,在如下图的界面里点击【头像设置】3、出现如下图界面后,选择右上角的【我的博客】左边那个选项,我的是【张昺华-sky】4、出现如下图后右键--【查看网页源代码】5、出现下图后,按快捷键【ctrl+f】搜索【use...
分类:
其他好文 时间:
2014-12-03 21:15:11
阅读次数:
231
Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t...
分类:
其他好文 时间:
2014-12-03 21:14:43
阅读次数:
202
红寺堡镇漠漠平林一望中,参差新瓦绿映红。古今画手知多少,除却松嵒无此工。注:松嵒,即钱松嵒(1899.9-1985.9),当代画家。是当代中国山水画主要代表人之一。红寺堡农村所见家家新房少妇姑,户户微香无瓦炉。又是一年春事了,杞园麦地笑相呼。
分类:
其他好文 时间:
2014-12-03 21:15:50
阅读次数:
180
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.For example:Given the below binary tree andsum =...
分类:
其他好文 时间:
2014-12-03 21:13:33
阅读次数:
182
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他好文 时间:
2014-12-03 21:14:01
阅读次数:
198
在 ARM 汇编语言程序里,有一些特殊指令助记符,这些助记符与指令系统的助记符不同,没有相对应的操作码,通常称这些特殊指令助记符为伪指令,他们所完成的操作称为伪操作。伪指令在源程序中的作用是为完成汇编程序作各种准备工作的,这些伪指令仅在汇编过程中起作用,一旦汇编结束,伪指令的使命就完成。 在 ARM...
分类:
其他好文 时间:
2014-12-03 21:14:18
阅读次数:
270
Combination SumCombination Sum Total Accepted: 25850 Total Submissions: 96391 My Submissions Question Solution Given a set of candidate numbers (C) an...
分类:
其他好文 时间:
2014-12-03 21:15:19
阅读次数:
163
ActiceAndroid的简介ActiveAndroid是一个活跃的记录风格的ORM(对象关系映射)库。ActiveAndroid可以让您保存和检索的SQLite数据库记录而没有写一个SQL语句。每个数据库记录被整齐包裹成一个model类,像保存方法()和delete()。AA使用教材:https...
分类:
移动开发 时间:
2014-12-03 21:12:46
阅读次数:
209
Letter Combinations of a Phone NumberGiven a digit string, return all possible letter combinations that the number could represent.A mapping of digit ...
分类:
其他好文 时间:
2014-12-03 21:12:18
阅读次数:
188
import UIKitclass LableViewController: BaseViewController { override func viewDidLoad() { super.viewDidLoad() let bodyFontDescriptor = UIFontDes...
分类:
其他好文 时间:
2014-12-03 21:14:04
阅读次数:
164