結果

問題 No.560 ふしぎなナップサック
ユーザー aaaaaa
提出日時 2018-09-27 14:20:51
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,200 bytes
コンパイル時間 745 ms
コンパイル使用メモリ 98,024 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-20 09:03:46
合計ジャッジ時間 1,419 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <map>
#include <iomanip>
#include <math.h> 
#include <stack>
#include <queue>
#include <bitset>
#include <cstdlib>
#include <tuple>
#include <cctype>
#include <ctype.h>
#include <set>

using namespace std;
double m, n;
double sum = 0;

int func(double mm, int nn) {
	
	if (nn == 0) {
		//
		//cout << "mm->" << mm << endl;
		sum += mm;
		return 0;
	}

	func(mm * 2, nn - 1);
	func(mm + 1, nn - 1);
	func(0, nn - 1);

	
	return 0;
}

int main() {
	int  i, j, k;
	

	cin >> m >> n;

	double ont = 1.0 / 3.0;
	double num = 0;


	if (m == 0) {
		for (i = 0; i < n; i++) {
			num += ont;
		}
		cout << fixed << setprecision(10) << num << endl;
	}
	else {
		for (i = 0; i < n; i++) {
			m += ont;
		}
		cout << fixed << setprecision(10) << m << endl;
	}

	/*
	double num2 = 0;

	for (i = 0; i < 10; i++) {
		func(m, (int)n + i);

		double num = pow(3, n + i);
		
		cout << "i->" << i << " " << fixed << setprecision(10) << sum / num << endl;
		cout << "num-num2 " << (sum / num) - num2 << endl << endl;

		num2 = sum / num;
		sum = 0;

	}*/


	getchar();
	getchar();
	return 0;
}
0