Pages

Wednesday, 5 August 2015

SPOJ PROBLEM 21079. THE RESISTANCE



Problem Link: http://www.spoj.com/problems/RESSTNCE/

SUMMARY:
In this problem, we are constructing a long network of resistors composed of N blocks. Every block has two 1 ohm resistors, shown below by the upper-left figure. We would like for you to measure the net resistance across the two leftmost terminals in a circuit with N blocks. If the circuit has one block (N=1), then the net resistance across the leftmost terminals is 1 ohm, because the horizontal resistor is not in a path connecting the leftmost terminals. Similarly, for a circuit with two blocks (N=2), the net resistance is 2/3 ohms. The figures below illustrate this.

Logic:
ans = (fibo(2n-1)%m)/(fibo(2n)%m)

To View My Solution:

No comments:

Post a Comment