This commit is contained in:
e2hang
2025-08-14 12:59:59 +08:00
parent 8bfe9f31f3
commit 5ebd540fa5
4 changed files with 115 additions and 23 deletions

View File

@@ -0,0 +1,19 @@
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<int> feb;
int n, a, m, x;
cin >> a >> n >> m >> x;
feb.reserve(n);
feb.push_back(1);feb.push_back(1);
for(int i = 2; i < n; i++){
feb[i] = feb[i - 1] + feb[i - 2];
}
int b = (m - (feb[n - 4] + 1) * a) / (feb[n - 3] - 1);
int out = (feb[x - 3] + 1) * a + (feb[x - 2] - 1) * b;
cout << out << endl;
return 0;
}
//5 7 32 4