結果

問題 No.542 1円玉と5円玉
ユーザー LightBellsLightBells
提出日時 2017-07-14 23:24:45
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 829 bytes
コンパイル時間 1,390 ms
コンパイル使用メモリ 164,088 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-16 20:32:39
合計ジャッジ時間 6,410 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,448 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 43 ms
5,376 KB
testcase_06 AC 1,603 ms
5,376 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for (int i=n;^i;i--)
#define ALL(v) v.begin(),v.end()
// #define int ll 
#define eps 1e-9
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))

template<class T> inline void chmax(T &a, const T &b) { if(a < b) a = b; }
template<class T> inline void chmin(T &a, const T &b) { if(a > b) a = b; }
typedef long long ll;

void dfs(int,int,int);
set<int> mon;

int main(void){
    int yen1,yen5;
    cin >> yen1 >> yen5;
    dfs(yen1,yen5,0);
    mon.erase(0);
    for (auto i=mon.begin();i!=mon.end();++i){
        cout << *i << endl;
    }
    return 0;
}

void dfs(int a,int b,int sum){
    mon.insert(sum);
    if (!(a<=0))
        dfs(a-1,b,sum+1);
    if (!(b<=0))
        dfs(a,b-1,sum+5);
    else
        return;
}
0