結果

問題 No.2681 ゲームセンターの両替
ユーザー Maffy-0
提出日時 2024-03-20 21:30:07
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 510 bytes
コンパイル時間 2,242 ms
コンパイル使用メモリ 193,684 KB
最終ジャッジ日時 2025-02-20 08:47:11
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void fast_io() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
}

signed main(void) {
    fast_io();
    long C, Y;
    cin >> C >> Y;
    if (100 * C > Y) {
        cout << "can't exchange\n";
        return 0;
    }
    int coin = (Y / 100) % 10;
    if (coin >= 5) coin -= 5;

    if (coin >= C) {
        cout << "no exchange\n";
        return 0;
    }

    int ans = coin;
    while (ans < C) ans += 5;
    cout << ans << endl;
    return 0;
}
0