링크 : https://www.acmicpc.net/problem/17211
#include <iostream>
#include <vector>
using namespace std;
int main() {
int day = 0, now = 0;
cin >> day >> now;
float g_g = 0, g_b = 0, b_g = 0, b_b = 0;
cin >> g_g >> g_b >> b_g >> b_b;
vector<float> good;
vector<float> bad;
if (now == 0){
good.push_back(g_g);
bad.push_back(g_b);
}
else{
good.push_back(b_g);
bad.push_back(b_b);
}
for(int i = 1; i < day; i++){
good.push_back(good.back() * g_g + bad.back() * b_g);
bad.push_back(good.back() * g_b + bad.back() * b_b);
}
cout<<fixed;
cout.precision(0);
cout << good.back() * 1000 << endl;
cout << bad.back() * 1000 << endl;
return 0;
}