結果
| 問題 | No.736 約比 | 
| コンテスト | |
| ユーザー |  toshiro_yanagi | 
| 提出日時 | 2018-12-29 13:19:06 | 
| 言語 | Nim (2.2.0) | 
| 結果 | 
                                CE
                                 
                            (最新) 
                                AC
                                 
                            (最初) | 
| 実行時間 | - | 
| コード長 | 790 bytes | 
| コンパイル時間 | 880 ms | 
| コンパイル使用メモリ | 65,632 KB | 
| 最終ジャッジ日時 | 2024-11-14 20:45:01 | 
| 合計ジャッジ時間 | 1,375 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
            
            
            
            
            ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: Use the new 'sugar' module instead; future is deprecated [Deprecated] /home/judge/data/code/Main.nim(35, 8) Error: undeclared identifier: 'lc'
ソースコード
import future, strutils
proc nextString: string =
   result = ""
   while not endOfFile stdin:
      let nextChar = readChar stdin
      case nextChar
      of '\r':
         discard
      of "\n"[0], ' ':
         break
      else:
         add result, nextChar
proc nextInt: int =
   return parseInt nextString()
proc gcd(x, y: int): int =
   var (a, b) = (x, y)
   if b > a:
      swap(a, b)
   while true:
      let c = a mod b
      if c == 0:
         return b
      a = b
      b = c
let
   n = nextInt()
   a = lc[nextInt() | (x <- 0..<n), int]
proc main: void =
   var k = a[0]
   for i in 1..<n:
      k = gcd(k, a[i])
   
   for i in 0..<n:
      if i != 0:
         write stdout, ":"
      write stdout, a[i] div k
   write stdout, "\n"
when isMainModule:
   main()
            
            
            
        