結果

問題 No.29 パワーアップ
ユーザー MiyamonYMiyamonY
提出日時 2019-09-03 14:06:49
言語 Scheme
(Gauche-0.9.14)
結果
AC  
実行時間 25 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 5,296 KB
実行使用メモリ 14,840 KB
最終ジャッジ日時 2023-08-25 15:37:07
合計ジャッジ時間 2,715 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 24 ms
12,888 KB
testcase_01 AC 24 ms
12,848 KB
testcase_02 AC 24 ms
14,840 KB
testcase_03 AC 24 ms
12,644 KB
testcase_04 AC 24 ms
12,700 KB
testcase_05 AC 25 ms
12,668 KB
testcase_06 AC 25 ms
12,900 KB
testcase_07 AC 24 ms
12,792 KB
testcase_08 AC 25 ms
12,912 KB
testcase_09 AC 24 ms
12,660 KB
testcase_10 AC 25 ms
12,732 KB
testcase_11 AC 25 ms
12,724 KB
testcase_12 AC 24 ms
12,652 KB
testcase_13 AC 25 ms
12,668 KB
testcase_14 AC 24 ms
12,772 KB
testcase_15 AC 25 ms
12,792 KB
testcase_16 AC 25 ms
12,684 KB
testcase_17 AC 24 ms
12,652 KB
testcase_18 AC 24 ms
12,668 KB
testcase_19 AC 24 ms
12,808 KB
testcase_20 AC 25 ms
12,696 KB
testcase_21 AC 24 ms
12,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

(define (read-number)
  (string->number (read-line)))

(define vec (make-vector 10 0))

(define extra 0)

(let ((_ (read-number)))
  (let loop ((row (read-line)))
    (cond ((eof-object? row) '())
	  (else
	   (let loop-inner ((column (map string->number (string-split row #\space))))
	     (if (null? column)
		 '()
		 (let ((n (car column)))
		   (vector-set! vec (- n 1) (+ 1 (vector-ref vec (- n 1))))
		   (loop-inner (cdr column)))))
	   (loop (read-line)))))

  (let1 total (fold + 0
		    (map (lambda (n)
			   (set! extra (+ extra (mod (vector-ref vec n) 2)))
			   (div (vector-ref vec n) 2)) (iota 10)))
	(print (+ total (div extra 4)))))
0