結果
問題 | No.352 カード並べ |
ユーザー | ayaoni |
提出日時 | 2020-12-25 10:35:22 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 41 ms / 2,000 ms |
コード長 | 724 bytes |
コンパイル時間 | 1,334 ms |
コンパイル使用メモリ | 81,504 KB |
実行使用メモリ | 53,364 KB |
最終ジャッジ日時 | 2023-10-22 02:13:39 |
合計ジャッジ時間 | 1,288 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge13 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,360 KB |
testcase_01 | AC | 40 ms
53,364 KB |
testcase_02 | AC | 40 ms
53,364 KB |
testcase_03 | AC | 39 ms
53,364 KB |
testcase_04 | AC | 39 ms
53,364 KB |
testcase_05 | AC | 40 ms
53,364 KB |
testcase_06 | AC | 40 ms
53,364 KB |
testcase_07 | AC | 41 ms
53,364 KB |
testcase_08 | AC | 40 ms
53,364 KB |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) N = I() ans = 1 for i in range(2,N+1): ans += 2/i # カードiが置かれた際にコスト1がかかる確率 = 2/i for i in range(1,N): for j in range(i+1,N+1): ans += 2*i*(1-j/N) # i*j というコストがかかる確率 = 2/j*(1-j/N) print(ans)