結果
| 問題 |
No.546 オンリー・ワン
|
| コンテスト | |
| ユーザー |
6soukiti29
|
| 提出日時 | 2017-07-18 08:36:35 |
| 言語 | Nim (2.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 805 bytes |
| コンパイル時間 | 806 ms |
| コンパイル使用メモリ | 64,256 KB |
| 最終ジャッジ日時 | 2024-06-30 01:38:34 |
| 合計ジャッジ時間 | 1,262 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(30, 27) Warning: Number of spaces around '-' is not consistent [Spacing]
/home/judge/data/code/Main.nim(9, 31) Error: type mismatch: got 'seq[int]' for 'map(split(readLine(stdin), {' ', '\t', '\v', '\r', '\n', '\f'}, -1), parseInt)' but expected 'tuple'
ソースコード
import sequtils,strutils,math
proc p2(i : int): int=
1 shl i
var
N,L,H,i,p,cnt : int
C,A : seq[int]
(N,L,H) = stdin.readline.split.map(parseInt)
C = stdin.readline.split.map(parseInt)
cnt = 0
for c in C:
cnt += H div c
cnt -= (L - 1) div c
for i in 0..p2(N):
A = @[]
for k in 0..N - 1:
if (i and p2(k)) > 0:
A.add(C[k])
if A.len > 1:
p = 1
block hantei:
for a in A:
try:
p = p * a div gcd(p, a)
except:
break hantei
if A.len mod 2 == 0:
cnt -= (H div p) * A.len
cnt += ((L- 1) div p) * A.len
else:
cnt += (H div p) * A.len
cnt -= ((L - 1) div p) * A.len
echo cnt
6soukiti29