提出 #5453483
ソースコード 拡げる
#include <bits/stdc++.h>
using namespace std;
long long n, k;
long double solve();
int main() {
cout << fixed << setprecision(12);
cin >> n >> k;
cout << solve() << endl;
return 0;
}
long double solve() {
long double ans = 0;
for(int i = 1; i <= n; ++i) {
long long now = i, cnt = 0;
while(now <= k - 1) {
++cnt;
now *= 2;
}
ans += 1.0 / (1LL << cnt);
}
return ans / n;
}
提出情報
| 提出日時 | |
|---|---|
| 問題 | C - Dice and Coin |
| ユーザ | m_tsubasa |
| 言語 | C++14 (GCC 5.4.1) |
| 得点 | 300 |
| コード長 | 446 Byte |
| 結果 | AC |
| 実行時間 | 1 ms |
| メモリ | 256 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 300 / 300 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| Sample | 01.txt, 02.txt |
| All | 01.txt, 02.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 01.txt | AC | 1 ms | 256 KiB |
| 02.txt | AC | 1 ms | 256 KiB |
| 11.txt | AC | 1 ms | 256 KiB |
| 12.txt | AC | 1 ms | 256 KiB |
| 13.txt | AC | 1 ms | 256 KiB |
| 14.txt | AC | 1 ms | 256 KiB |
| 15.txt | AC | 1 ms | 256 KiB |