結果

問題 No.32 貯金箱の憂鬱
コンテスト
ユーザー Mister
提出日時 2020-03-31 16:19:46
言語 C++17(clang)
(clang++ 22.1.2 + boost 1.89.0)
コンパイル:
clang++ -O2 -lm -std=c++1z -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 471 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,021 ms
コンパイル使用メモリ 135,552 KB
実行使用メモリ 7,972 KB
最終ジャッジ日時 2026-04-03 13:22:11
合計ジャッジ時間 1,572 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <vector>

std::vector<int> mon{100, 25, 1};

void solve() {
    int m = 0;
    for (auto d : mon) {
        int x;
        std::cin >> x;
        m += d * x;
    }

    int ans = 0;
    m %= 1000;
    for (auto d : mon) {
        ans += m / d;
        m %= d;
    }

    std::cout << ans << std::endl;
}

int main() {
    std::cin.tie(nullptr);
    std::cout.tie(nullptr);
    std::ios::sync_with_stdio(false);

    solve();

    return 0;
}
0