結果

問題 No.1446 ハンバーグと納豆ごはん
ユーザー yukileo9yukileo9
提出日時 2021-07-12 08:20:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 679 bytes
コンパイル時間 1,447 ms
コンパイル使用メモリ 164,652 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-14 20:26:57
合計ジャッジ時間 3,056 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 WA -
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 2 ms
4,380 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,380 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 AC 1 ms
4,376 KB
testcase_24 AC 1 ms
4,380 KB
testcase_25 AC 1 ms
4,376 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void no_1446(void) {
    long long a, b, n, m;
    cin >> a >> b >> n >> m;

    long long ans = min(a, b);
    a -= ans;
    b -= ans;
    if (a != 0) {
        long long a_div = a / n;
        long long a_remain = a % n;
        if(a_remain==0){
            a_div--;
            a_remain = n;
        }
        ans += min(a_div, a_remain);
    } else if(b!=0){
        long long b_div = b / m;
        long long b_remain = b % m;
        if(b_remain==0){
            b_div--;
            b_remain = m;
        }
        ans += min(b_div, b_remain);
    }
    cout << ans << endl;
}

int main(void) {
    no_1446();
    return 0;
}
0