結果
| 問題 | 
                            No.796 well known
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2019-05-05 15:15:52 | 
| 言語 | Nim  (2.2.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 753 bytes | 
| コンパイル時間 | 2,174 ms | 
| コンパイル使用メモリ | 60,980 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-01 23:26:30 | 
| 合計ジャッジ時間 | 3,148 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 15 | 
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'macros' [UnusedImport]
ソースコード
import macros
template times*(n:int,body) = (for _ in 0..<n: body)
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" ,discardable.}
proc scan(): int =
  while true:
    let k = getchar_unlocked()
    if k < '0': return
    result = 10 * result + k.ord - '0'.ord
proc puts(str: cstring){.header: "<stdio.h>", varargs.}
proc printf(formatstr: cstring){.header: "<stdio.h>", varargs.}
proc putchar_unlocked(c:char){. importc:"putchar_unlocked",header: "<stdio.h>" .}
let n = scan()
# 1 3   + [1 1 1]
# 1 3 3 + [1 1 1]
# 1 1 2 3 + [1 1 1]
if n mod 3 == 2: printf("1 3")
elif n mod 3 == 0: printf("1 3 3")
else:printf("1 1 2 3")
(n-[3,4,2][n mod 3]).times:
  putchar_unlocked(' ')
  putchar_unlocked('1')
putchar_unlocked('\n')