blob: 0d1f22a06257ef6b9de72ece02a00240043ba6bc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
|
(define (chfing n k)
(let ((p (quotient k n)))
(remainder (- (* k (1+ p)) (/ (* n p (1+ p)) 2)) 1000000007)))
(let loop ((t (read)))
(when (> t 0)
(display (chfing (1- (read)) (1- (read))))
(newline)
(loop (1- t))))
|