10求条!
查看原帖
10求条!
1635974
a15667495696楼主2025/7/24 17:59
#include <bits/stdc++.h>
using namespace std;
//fixed << setprecision()
int a, b, m, n;

int main(){
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> a >> b >> m >> n;
	int s[364] = {0, a, b}, t = a + b;
	for (int i = 3; i <= n; i++)
	{
		if (s[i] < m) s[i] = s[i - 1] + s[i - 2], t += s[i];
		else
		{
			cout << t;
			return 0;
		}
	}
	return 0;
}

2025/7/24 17:59
加载中...