JAG2010ProblemB

Moonlight Farm (defstruct seed name p a b c d e f s m) (defmethod calc-max-time ((s seed)) (+ (seed-a s) (seed-b s) (seed-c s) (seed-d s) (seed-e s) (loop for i from 1 upto (1- (seed-m s)) sum (+ (seed-d s) (seed-e s))))) (defmethod calc-m…

JAG2010ProblemA

Sum of Consecutive (defun iota (num) (loop for n from 1 upto num collect n)) (defun get-all-pattern (num) (let ((seq (iota (1+ (floor num 2))))) (loop for pat in (loop for i from 0 upto (1- (length seq)) append (loop for j from (+ 2 i) upt…

ICPC2009ProblemB

How Many Island? #include <stdio.h> int filledp(int map[],int w, int h) { int i,j; int filledp = 1; for(i = 0; i < h; i++) { for(j = 0; j < w; j++) { if(map[i][j] == 1) { filledp = 0; } } } return filledp; } void mark(int map[], int x, int </stdio.h>…

JAG2008 ProblemA

Princess's Gamble (defun ticket (m p votes) (let ((sum-of (* (/ (- 100 p) 100) (* 100 (apply #'+ votes))))) (if (zerop (nth (1- m) votes)) 0 (floor (/ sum-of (nth (1- m) votes)))))) (defun main () (loop for n = (read) for m = (read) for p …

JAG2011 ProblemA

koukyoukoukokukikou (defvar *qwarty-right* (coerce "yuiophjklnm" 'list)) (defvar *qwarty-left* (coerce "qwretasdfgzxcvb" 'list)) (defun count-hand-change (string) (let ((ch-list (coerce string 'list))) (labels ((%count-hand-change (ch-list…

ICPC2011ProblemA

チェビシェフの定理 (defun sieve-of-erathostenes (num) (let ((sieve (make-array num :initial-element 1))) (setf (aref sieve 0) 0) (loop for i from 1 upto (sqrt num) when (= 1 (aref sieve i)) do (loop for j from (1+ i) until (> (* (1+ i) j) …