結果

問題 No.560 ふしぎなナップサック
ユーザー AquaplusAquaplus
提出日時 2017-09-20 22:32:57
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 432 bytes
コンパイル時間 682 ms
コンパイル使用メモリ 61,384 KB
実行使用メモリ 10,016 KB
最終ジャッジ日時 2024-04-25 21:23:23
合計ジャッジ時間 4,084 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;

int sum(int m, int n, int now)
{
    if (n==now)
        return 3 * m + 1;
    else
        return sum(2 * m, n, now + 1) + sum(m + 1, n, now + 1) + sum(0, n, now + 1);
}

int main(void)
{
    int m, n;
    cin >> m >> n;
    double ans = sum(m, n, 1) / pow(3.0, n);
    printf("%.8f\n", ans);

    return 0;
}
0