08-14-25
This commit is contained in:
19
Luogu/P1011 [NOIP 1998 提高组] 车站.cpp
Normal file
19
Luogu/P1011 [NOIP 1998 提高组] 车站.cpp
Normal 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
|
||||
|
Reference in New Issue
Block a user