結果
問題 | No.546 オンリー・ワン |
ユーザー | tcltk |
提出日時 | 2021-07-02 17:18:47 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 259 ms / 2,000 ms |
コード長 | 696 bytes |
コンパイル時間 | 280 ms |
コンパイル使用メモリ | 86,728 KB |
実行使用メモリ | 92,616 KB |
最終ジャッジ日時 | 2023-09-11 11:24:21 |
合計ジャッジ時間 | 4,289 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 230 ms
89,328 KB |
testcase_01 | AC | 224 ms
89,000 KB |
testcase_02 | AC | 227 ms
89,184 KB |
testcase_03 | AC | 225 ms
89,136 KB |
testcase_04 | AC | 228 ms
89,240 KB |
testcase_05 | AC | 232 ms
89,032 KB |
testcase_06 | AC | 229 ms
88,996 KB |
testcase_07 | AC | 259 ms
92,576 KB |
testcase_08 | AC | 239 ms
92,616 KB |
testcase_09 | AC | 241 ms
92,572 KB |
testcase_10 | AC | 241 ms
92,588 KB |
ソースコード
#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """2 1 10 # 2 3 # """ # sys.stdin = io.StringIO(_INPUT) def get_lcm(a, b): return a * b // math.gcd(a, b) N, L, H = map(int, input().split()) C = list(map(int, input().split())) ans = 0 for s in range(1, 2**N): d = 1 m = 0 for i in range(N): if s & (1<<i): d = get_lcm(d, C[i]) m += 1 n = H//d - (L-1)//d if m % 2 == 1: ans += m*n else: ans -= m*n print(ans)