結果
問題 |
No.2681 ゲームセンターの両替
|
ユーザー |
|
提出日時 | 2024-03-20 21:15:41 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 534 bytes |
コンパイル時間 | 2,061 ms |
コンパイル使用メモリ | 194,524 KB |
最終ジャッジ日時 | 2025-02-20 08:31:48 |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 10 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int C,Y; cin >> C >> Y; if(C*100 > Y){cout << "can't exchange" << endl; return 0;} int N = 10; vector<int> money = {1,5,10,50,100,500,1000,2000,5000,10000}; reverse(money.begin(),money.end()); vector<int> have(N); for(int i=0; i<N; i++) have.at(i) = Y/money.at(i),Y %= money.at(i); if(have.at(5) >= C){cout << "no exchange" << endl; return 0;} cout << C+(5-C%5)%5 << endl; }