結果

問題 No.316 もっと刺激的なFizzBuzzをください
ユーザー schemelispschemelisp
提出日時 2015-12-15 13:13:42
言語 Scheme
(Gauche-0.9.15)
結果
AC  
実行時間 32 ms / 1,000 ms
コード長 421 bytes
コンパイル時間 30 ms
コンパイル使用メモリ 5,120 KB
実行使用メモリ 17,280 KB
最終ジャッジ日時 2024-11-21 11:59:40
合計ジャッジ時間 2,943 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (gcd x y)
  (let ((r (mod x y)))
    (if (= r 0)
	y
	(gcd y r))))

(define (lcm x y)
  (/ (* x y) (gcd x y)))

(define (sum n a b c)
  (-
   (+ (quotient n a)
      (quotient n b)
      (quotient n c)
      (quotient n (lcm a (lcm b c))))
   (quotient n (lcm a b))
   (quotient n (lcm b c))
   (quotient n (lcm c a))))

(let ((n (read))
      (a (read))
      (b (read))
      (c (read)))
  (print (sum n a b c)))
0