結果
| 問題 | No.546 オンリー・ワン |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-19 14:40:47 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
AC
|
| 実行時間 | 55 ms / 2,000 ms |
| コード長 | 342 bytes |
| 記録 | |
| コンパイル時間 | 179 ms |
| コンパイル使用メモリ | 85,248 KB |
| 実行使用メモリ | 65,920 KB |
| 最終ジャッジ日時 | 2026-05-19 14:40:50 |
| 合計ジャッジ時間 | 2,489 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_1 |
| 純コード判定待ち |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 |
ソースコード
def gcd(x,y):
while x%y:
x,y=y,x%y
return y
def bb(l,d):
return l//d
n,l,h=map(int,input().split())
c=list(map(int,input().split()))
ans=0
for i in range(1,1<<n):
d=1;s=-1;p=0
for j in range(n):
if i>>j&1:
s*=-1;d=min(1<<30,d*c[j]//gcd(d,c[j]));p+=1
ans+=s*(bb(h,d)-bb(l-1,d))*p
print(ans)