結果
問題 | No.2681 ゲームセンターの両替 |
ユーザー |
![]() |
提出日時 | 2024-07-18 16:40:16 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 499 bytes |
コンパイル時間 | 1,570 ms |
コンパイル使用メモリ | 169,220 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 16:40:20 |
合計ジャッジ時間 | 2,271 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h>using namespace std;using ll = long long;#define rep(i, n) for(int i = 0; i < n; i++)int main() {int c, y;cin >> c >> y;if(y / 100 < c) {cout << "can't exchange" << endl;return 0;}vector<int> v{10000, 5000, 2000, 1000, 500, 100}, num(6);rep(i, 6) {num[i] = y / v[i];y -= num[i] * v[i];}if(num[5] >= c) {cout << "no exchange" << endl;return 0;}int cc = c;cc -= num[5];int m = cc % 5;if(m) c += 5 - m;cout << c << endl;}