結果

問題 No.3433 [Cherry 8th Tune A] ADD OIL!
コンテスト
ユーザー ryoend
提出日時 2026-01-27 21:30:33
言語 C++17
(gcc 15.2.0 + boost 1.89.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 515 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,812 ms
コンパイル使用メモリ 214,132 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2026-01-27 21:30:37
合計ジャッジ時間 2,958 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    int t;
    cin >> t;
    for(;t--;){
        int n, k;
        cin >> n >> k;
        vector<int> a(n);
        ll s = 1;
        for(int i = 0; i < n; i++){
            cin >> a[i];
            s *= a[i];
        }

        ll ans = 1e18;
        for(int i = 0; i < n; i++){
            ll cal = s / a[i];
            cal *= (a[i]-k);

            ans = min(ans, cal);
        }
        cout << ans << endl;
    }
    return 0;
}
0