結果
問題 | No.2099 [Cherry Alpha B] Time Machine |
ユーザー |
|
提出日時 | 2022-10-15 01:16:51 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 626 bytes |
コンパイル時間 | 1,960 ms |
コンパイル使用メモリ | 192,312 KB |
最終ジャッジ日時 | 2025-02-08 05:51:29 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 64 WA * 8 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll T,X,A,Y,B; cin >> T >> X >> A >> Y >> B; ll ans = numeric_limits<ll>::max(); for(ll x = 0; x <= ll(1e7); x++) { ll y = (A * x - T + B - 1) / B; ll z = T - (A * x - B * y); if(0 <= y && 0 <= z) ans = min(ans, X * x + Y * y + z); y = (A * x - T) / B; z = T - (A * x - B * y); if(0 <= y && 0 <= z) ans = min(ans, X * x + Y * y + z); } cout << ans << endl; }