結果
問題 |
No.560 ふしぎなナップサック
|
ユーザー |
|
提出日時 | 2017-09-20 22:32:57 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 432 bytes |
コンパイル時間 | 659 ms |
コンパイル使用メモリ | 60,972 KB |
実行使用メモリ | 8,576 KB |
最終ジャッジ日時 | 2024-11-08 09:20:51 |
合計ジャッジ時間 | 4,175 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 TLE * 1 -- * 1 |
other | -- * 12 |
ソースコード
#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; }