結果
問題 |
No.542 1円玉と5円玉
|
ユーザー |
![]() |
提出日時 | 2017-12-21 08:30:58 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 496 bytes |
コンパイル時間 | 868 ms |
コンパイル使用メモリ | 66,772 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-17 20:40:08 |
合計ジャッジ時間 | 1,263 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 5 WA * 5 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> using namespace std; int judge[101][101] = {}; int A=0; int B=0; vector<int> ans; void dfs(int a, int b){ if(a>A|| b>B|| judge[a][b] == 1){ return; } judge[a][b] =1; if((1*a+5*b) !=0){ ans.push_back(1*a+5*b); } dfs(a+1,b); dfs(a,b+1); } int main() { cin>>A>>B; dfs(0,0); sort(ans.begin(),ans.end()); for(int i=0; i<ans.size(); i++){ cout<<ans[i]<<endl; } return 0; }