forked from hackerearthclub/CODE2RACE
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
TANIYA GUPTA
authored
Oct 19, 2018
1 parent
301e509
commit 84860e6
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
An electric circuit uses exclusively identical capacitors of the same value <b>C</b>. | ||
|
||
The capacitors can be connected in series or in parallel to form sub-units, which can then be connected in series or in parallel with other capacitors or other sub-units to form larger sub-units, and so on up to a final circuit. | ||
|
||
Using this simple procedure and up to <b>n</b> identical capacitors, we can make circuits having a range of different total capacitances. For example, using up to <b>n=3</b> capacitors of <b>60 uF</b> each, we can obtain the following <b>7</b> distinct total capacitance values: | ||
|
||
 | ||
|
||
If we denote by <b>D(n)</b> the number of distinct total capacitance values we can obtain when using up to <b>n</b> equal-valued capacitors and the simple procedure described above, we have: <b>D(1)=1, D(2)=3, D(3)=7,....</b> | ||
|
||
Find <b>D(n)</b>. | ||
|
||
##### Reminder : When connecting capacitors C1, C2 etc in parallel, the total capacitance is, | ||
 | ||
|
||
##### whereas when connecting them in series, the overall capacitance is given by: | ||
 | ||
|
||
#### Input Format | ||
|
||
Each test file contains a single integer <b>n</b> . | ||
|
||
#### Output Format | ||
|
||
Output a single number i.e. <b>D(n)</b>. | ||
|
||
#### CONSTRAINTS | ||
|
||
1≤ n ≤ 18 | ||
|
||
#### Sample Input | ||
``` | ||
3 | ||
``` | ||
|
||
#### Sample Output | ||
``` | ||
7 | ||
``` |