You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
400 B
23 lines
400 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
const int N = 110;
|
|
double a[N], c[N];
|
|
|
|
int main() {
|
|
a[1] = 2;
|
|
c[1] = 1;
|
|
|
|
a[2] = 3;
|
|
c[2] = 2;
|
|
|
|
double s = a[1] / c[1] + a[2] / c[2];
|
|
for (int i = 3; i <= 20; i++) {
|
|
a[i] = a[i - 1] + a[i - 2];
|
|
c[i] = c[i - 1] + c[i - 2];
|
|
s += a[i] / c[i];
|
|
}
|
|
cout << s << endl;
|
|
return 0;
|
|
} |