結果
問題 | No.2099 [Cherry Alpha B] Time Machine |
ユーザー |
|
提出日時 | 2022-10-14 23:08:05 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 470 bytes |
コンパイル時間 | 1,731 ms |
コンパイル使用メモリ | 165,968 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 16:59:53 |
合計ジャッジ時間 | 12,969 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 28 WA * 44 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<int(n);i++) typedef long long ll; typedef pair<int,int> P; int main(void){ ll i,j; cin.tie(0); ios_base::sync_with_stdio(false); ll T; cin >> T; ll X,A,Y,B; cin >> X >> A >> Y >> B; ll mn=1e18; for(i=0;i<=10000;i++){ for(j=0;j<=10000;j++){ if(A*i-B*j>T) continue; ll d=(X-A)*i+(Y+B)*j+T; if(d<0) continue; mn=min(mn,d); } } cout << mn << endl; return 0; }