結果

問題 No.560 ふしぎなナップサック
コンテスト
ユーザー Aquaplus
提出日時 2017-09-20 22:32:57
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 432 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 300 ms
コンパイル使用メモリ 85,324 KB
実行使用メモリ 10,048 KB
最終ジャッジ日時 2026-09-21 05:31:22
合計ジャッジ時間 6,346 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 TLE * 1 -- * 1
other -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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