結果

問題 No.736 約比
ユーザー varrhovarrho
提出日時 2019-09-26 02:38:41
言語 Nim
(2.2.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 402 bytes
コンパイル時間 4,597 ms
コンパイル使用メモリ 66,140 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-23 04:58:27
合計ジャッジ時間 6,027 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 65
権限があれば一括ダウンロードができます

ソースコード

diff #

import math, sequtils, strutils
proc gcds(x: seq[int]): int =
  var y: seq[int] = x
  while y.len > 1:
    var tmp: int = gcd(y[0], y[1])
    y.delete(0)
    y[0] = tmp
  return y[0]
let n: int = stdin.readline.parseInt
var
  a: seq[int] = stdin.readline.split.map(parseInt)
  b: int = a.gcds
  ans: string
a = a.mapIt(it div b)
for i in 0..<n:
  ans &= $(a[i])
  if i != n - 1:
    ans &= ':'
echo ans
0