#include #include #include using namespace std; int T, N; int Money; int L[19]; int S[19], P[19], R[19]; int Prev_Ad; double Expected_D[19], Sum_D[19], Cnt_D[19]; void Decide_L(int turn) { // 広告を打つ場合 if (turn >= 6 && Money >= 1500000 && turn - Prev_Ad) { cout << "2 2" << endl; Prev_Ad = turn; } else { int NeedMoney = 0; for (int i = 1; i <= N; i++) { double keisuu = 9.0; if (P[i] >= 50) keisuu = 75.0; int Goal = keisuu * pow(1.05, 1.0 * P[i]) * Expected_D[i] * pow(1.05, 1.0 * P[i]); Goal = max(1, Goal - R[i]); L[i] = Goal; NeedMoney += 500 * Goal; } if (NeedMoney > Money) { for (int i = 1; i <= N; i++) L[i] = (1LL * L[i] * Money / NeedMoney); } cout << 1; for (int i = 1; i <= N; i++) cout << " " << L[i]; cout << endl; } } int main() { // 最初の入力 cin >> T >> N >> Money; for (int i = 1; i <= N; i++) Expected_D[i] = 1.0; // インタラクティブ開始 for (int t = 1; t <= T; t++) { // (あ) 行動を決める Decide_L(t); // (い) 売上部数などを入力する cin >> Money; for (int i = 1; i <= N; i++) cin >> S[i]; for (int i = 1; i <= N; i++) cin >> P[i]; for (int i = 1; i <= N; i++) cin >> R[i]; // D の値を更新 for (int i = 1; i <= N; i++) { if (S[i] == 0) continue; int moto_popular = P[i]; if (10 * S[i] >= 3 * (S[i] + R[i])) moto_popular -= 1; if (10 * S[i] < 1 * (S[i] + R[i])) moto_popular += 1; double expected = (0.5 + S[i]) / (pow(1.0 * (S[i] + R[i]), 0.5) * pow(1.05, moto_popular)); Sum_D[i] += expected; Cnt_D[i] += 1.0; Expected_D[i] = min(1.45, max(0.55, Sum_D[i] / Cnt_D[i])); } // デバッグ出力 cerr << Money << endl; for (int i = 1; i <= N; i++) cerr << S[i] << " "; cerr << endl; for (int i = 1; i <= N; i++) cerr << P[i] << " "; cerr << endl; for (int i = 1; i <= N; i++) cerr << R[i] << " "; cerr << endl; } return 0; }