結果
問題 |
No.2681 ゲームセンターの両替
|
ユーザー |
![]() |
提出日時 | 2024-03-20 23:22:07 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 454 bytes |
コンパイル時間 | 1,341 ms |
コンパイル使用メモリ | 168,928 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-05 04:14:02 |
合計ジャッジ時間 | 2,054 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { int C, Y; cin >> C >> Y; vector<int> val = {1, 5, 10, 50, 100, 500, 1000, 2000, 5000, 10000}, coin(10); if (Y / 100 < C) { cout << "can't exchange" << endl; return 0; } for (int i = 9; i >= 0; i--) { coin.at(i) = Y / val.at(i); Y %= val.at(i); } if (coin.at(4) >= C) { cout << "no exchange" << endl; return 0; } cout << coin.at(4) + (C - coin.at(4) + 4) / 5 * 5 << endl; }