結果

問題 No.32 貯金箱の憂鬱
ユーザー なお
提出日時 2014-09-29 19:22:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 388 bytes
コンパイル時間 625 ms
コンパイル使用メモリ 56,036 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-23 01:57:18
合計ジャッジ時間 968 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

const int COINNUM = 3;
const int p[COINNUM] = {100,25,1};

int main(){
    int total = 0, res = 0;
    for(int i = 0; i < COINNUM; i++){
        int coin; cin >> coin;
        total += p[i] * coin;
    }
    total %= 1000;
    for(int i = 0; i < COINNUM; i++){
        res += total / p[i];
        total %= p[i];
    }
    cout << res << endl;
}
0