結果

問題 No.358 も~っと!門松列
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-13 01:46:15
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 396 bytes
コンパイル時間 1,231 ms
コンパイル使用メモリ 55,556 KB
最終ジャッジ日時 2023-09-13 03:45:26
合計ジャッジ時間 2,401 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(4, 21) Error: attempting to call undeclared routine: 'safeAdd'

ソースコード

diff #

import strutils, sequtils

proc makeB(A: seq[int], p: int): seq[int] =
  for a in A: result.safeAdd(a mod p)

proc judge(B: seq[int]): bool =
  if B.deduplicate.len == B.len:
    if B[1] == B.max or B[1] == B.min:
      result = true

let A = stdin.readLine.split.map parseInt
var cnt = 0

if A.judge:
  echo "INF"
else:
  for p in 1 .. A.max:
    if A.makeB(p).judge:
      cnt += 1

  echo cnt
0