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.

18 lines
408 B

1 year ago
#include <bits/stdc++.h>
using namespace std;
const int N = 366;
int a[N];
int sum;
int main() {
cin >> a[1] >> a[2]; // 第一天a[1]道题第二天a[2]道题
int n, m;
cin >> m >> n;
sum += a[1], sum += a[2];
for (int i = 3;; i++) {
a[i] = a[i - 1] + a[i - 2];
if (a[i] >= m) break;
sum += a[i];
}
cout << sum << endl;
return 0;
}