結果
| 問題 |
No.560 ふしぎなナップサック
|
| コンテスト | |
| ユーザー |
aaa
|
| 提出日時 | 2018-09-27 14:20:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 1,200 bytes |
| コンパイル時間 | 1,189 ms |
| コンパイル使用メモリ | 95,408 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 04:27:33 |
| 合計ジャッジ時間 | 1,826 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#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;
}
aaa