結果
問題 | No.546 オンリー・ワン |
ユーザー | t8m8⛄️ |
提出日時 | 2017-07-22 00:40:45 |
言語 | Nim (2.2.0) |
結果 |
RE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 689 bytes |
コンパイル時間 | 3,435 ms |
コンパイル使用メモリ | 66,488 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-30 01:44:19 |
合計ジャッジ時間 | 4,028 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 4 RE * 3 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 39) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(1, 39) Warning: imported and not used: 'future' [UnusedImport] /home/judge/data/code/Main.nim(1, 28) Warning: imported and not used: 'algorithm' [UnusedImport]
ソースコード
import strutils, sequtils, algorithm, future, math {.warning[SmallLshouldNotBeUsed]: off.} proc cnt(x, n: int, a: seq[int]): int = for i in 0..<(1 shl a.len): if i.toBin(a.len+1).count('1') != n: continue var l = 1 for j in 0..<a.len: if ((i shr j) and 1) != 1: continue l = lcm(l, a[j]) result += (x div l)*n when isMainModule: var input = stdin.readLine.split.map(parseInt) (n, l, h) = (input[0], input[1], input[2]) a = stdin.readLine.split.map(parseInt) x, y: int64 = 0 for i in 1..n: if i mod 2 == 1: x += cnt(l-1, i, a) y += cnt(h, i, a) else: x -= cnt(l-1, i, a) y -= cnt(h, i, a) echo y - x