Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int n;
- double niza[105];
- double rec(int i, double result) {
- if(i == 0) {
- return result;
- }
- return rec(i - 1, 1.0 / (result + niza[i]));
- }
- int main()
- {
- cin >> n;
- for(int i = 0; i < n; i++) {
- cin >> niza[i];
- }
- cout << rec(n - 1, 0.0) + niza[0] << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement