結果
| 問題 |
No.546 オンリー・ワン
|
| コンテスト | |
| ユーザー |
fiord
|
| 提出日時 | 2017-07-19 15:01:44 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
AC
|
| 実行時間 | 37 ms / 2,000 ms |
| コード長 | 358 bytes |
| コンパイル時間 | 376 ms |
| コンパイル使用メモリ | 12,416 KB |
| 実行使用メモリ | 10,752 KB |
| 最終ジャッジ日時 | 2024-10-08 14:20:43 |
| 合計ジャッジ時間 | 1,333 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 |
ソースコード
import math
n, l, h = map(int, input().split())
l -= 1
c = list(map(int, input().split()))
ret = 0
m = 1 << n
for i in range(1, m):
cnt = bin(i).count("1")
g = 1
for j in range(n):
if (i >> j) & 1:
g = int(g * c[j] / math.gcd(g, c[j]))
add = (int(h / g) - int(l / g)) * cnt * (-1)**(cnt & 1 ^ 1)
ret += add
print(ret)
fiord