結果

問題 No.2681 ゲームセンターの両替
ユーザー 尾崎里紗
提出日時 2024-03-04 17:54:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 482 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 64,416 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-05 03:59:57
合計ジャッジ時間 1,316 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main() {
    int c, y;
    cin >> c >> y;
    int bc = (y % 1000) / 100;
    if (bc >= 5) {
        bc -= 5;
    }
    if (bc >= c) {
        cout << "no exchange" << endl;
    } else if (c * 100 > y) {
        cout << "can't exchange" << endl;
    } else {
        int rest = y - (100 * c);
        int b = (rest % 1000) / 100;
        if (b >= 5) {
            b -= 5;
        }
        cout << (b + c) << endl;
    }
    return 0;
}
0