結果

問題 No.2099 [Cherry Alpha B] Time Machine
ユーザー 👑 KazunKazun
提出日時 2022-08-28 17:00:54
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 623 bytes
コンパイル時間 2,193 ms
コンパイル使用メモリ 199,216 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-09-08 19:52:05
合計ジャッジ時間 28,172 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 326 ms
4,380 KB
testcase_01 AC 328 ms
4,384 KB
testcase_02 WA -
testcase_03 AC 327 ms
4,380 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 324 ms
4,384 KB
testcase_08 AC 326 ms
4,380 KB
testcase_09 AC 328 ms
4,384 KB
testcase_10 AC 326 ms
4,384 KB
testcase_11 AC 326 ms
4,380 KB
testcase_12 AC 325 ms
4,380 KB
testcase_13 AC 326 ms
4,380 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 327 ms
4,384 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 326 ms
4,380 KB
testcase_23 AC 325 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 323 ms
4,380 KB
testcase_28 AC 326 ms
4,380 KB
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 327 ms
4,384 KB
testcase_33 AC 326 ms
4,380 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 328 ms
4,380 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 323 ms
4,384 KB
testcase_42 WA -
testcase_43 AC 324 ms
4,384 KB
testcase_44 AC 326 ms
4,384 KB
testcase_45 WA -
testcase_46 AC 323 ms
4,384 KB
testcase_47 WA -
testcase_48 AC 325 ms
4,380 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 322 ms
4,384 KB
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 325 ms
4,380 KB
testcase_57 AC 327 ms
4,380 KB
testcase_58 AC 327 ms
4,384 KB
testcase_59 AC 328 ms
4,384 KB
testcase_60 AC 328 ms
4,384 KB
testcase_61 AC 328 ms
4,380 KB
testcase_62 AC 328 ms
4,380 KB
testcase_63 AC 325 ms
4,380 KB
testcase_64 AC 326 ms
4,384 KB
testcase_65 AC 325 ms
4,380 KB
testcase_66 WA -
testcase_67 AC 327 ms
4,380 KB
testcase_68 AC 324 ms
4,384 KB
testcase_69 AC 326 ms
4,380 KB
testcase_70 AC 326 ms
4,380 KB
testcase_71 AC 325 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;
using ll=long long;

template<typename T, typename U>
T floor(T x, U y){return (x>0 ? x/y: (x-y+1)/y);}

template<typename T, typename U>
T ceil(T x, U y){return (x>0 ? (x+y-1)/y: x/y);}

template<typename T, typename U>
pair<T,T> divmod(T x, U y){
    T q=floor(x,y);
    return {q,x-q*y};
}

int main(){
    ll T,A,B,X,Y;
    cin >> T >> X >> A >> Y >> B;

    ll Ans=1001001001001001001;
    for (int r=0; r<=30000000; r++){
        ll q,p;
        tie (q,p)=divmod(T+r*B, A);
        Ans=min(Ans, p+q*X+r*Y);
    }

    cout << Ans << endl;
}
0