結果
| 問題 |
No.593 4進FizzBuzz
|
| コンテスト | |
| ユーザー |
Common Lisp
|
| 提出日時 | 2024-11-07 17:10:03 |
| 言語 | Common Lisp (sbcl 2.5.0) |
| 結果 |
AC
|
| 実行時間 | 103 ms / 2,000 ms |
| コード長 | 641 bytes |
| コンパイル時間 | 380 ms |
| コンパイル使用メモリ | 27,392 KB |
| 実行使用メモリ | 38,272 KB |
| 最終ジャッジ日時 | 2024-11-07 17:10:09 |
| 合計ジャッジ時間 | 4,420 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 31 |
コンパイルメッセージ
; compiling file "/home/judge/data/code/Main.lisp" (written 07 NOV 2024 05:10:04 PM): ; wrote /home/judge/data/code/Main.fasl ; compilation finished in 0:00:00.072
ソースコード
(defun main (&rest argv)
(declare (ignorable argv))
(let* ((s (read-line))
(3rd 0)
(5th 0)
(d 1))
(loop for c across s do
(let ((i (digit-char-p c)))
(incf 3rd i)
(incf 5th (* i d))
(setf d (* d -1))))
(format t "~a~%" (cond ((and (zerop (mod 3rd 3)) (zerop (mod 5th 5)))
"FizzBuzz")
((zerop (mod 3rd 3))
"Fizz")
((zerop (mod 5th 5))
"Buzz")
(t
s)))))
(main)
Common Lisp