結果

問題 No.637 X: Yet Another FizzBuzz Problem
ユーザー toshiro_yanagitoshiro_yanagi
提出日時 2018-06-06 22:10:46
言語 Nim
(2.0.2)
結果
CE  
(最新)
AC  
(最初)
実行時間 -
コード長 279 bytes
コンパイル時間 778 ms
コンパイル使用メモリ 56,236 KB
最終ジャッジ日時 2023-09-12 22:53:26
合計ジャッジ時間 1,178 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。

コンパイルメッセージ
/home/judge/data/code/Main.nim(10, 7) Error: type mismatch: got <string, int>
but expected one of:
proc add(x: var string; y: char)
  first type mismatch at position: 2
  required type for y: char
  but expression 'x' is of type: int
proc add(x: var string; y: cstring)
  first type mismatch at position: 2
  required type for y: cstring
  but expression 'x' is of type: int
proc add(x: var string; y: string)
  first type mismatch at position: 2
  required type for y: string
  but expression 'x' is of type: int
2 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them

expression: add(bf, x)

ソースコード

diff #

import strutils, sequtils

proc fzbz(x: int): auto =
  var bf = ""
  if x mod 3 == 0:
    bf.add "Fizz"
  if x mod 5 == 0:
    bf.add "Buzz"
  if bf == "":
    bf.add x
  result = bf.len

let a = stdin.readLine.split.map parseInt

var ans = 0
for a in a: ans.inc a.fzbz
echo ans
0