arrow $B > $BCN<1$N6L > $B%o%s%]%$%s%H(BTips >

$B%j%+!<%7%V!&%3!<%k(B

$B!!%j%+!<%7%V$H$O!"F~$l;R$N$3$H$G$"$k!#?F55$NGXCf$K>.55$,>h$C$F!">.55$NGXCf$KB955$,!D!#$H!"L58B$KB3$/9=B$$r;X$9!#$3$&$$$&9=B$$N%W%m%0%i%`$r%j%+!<%7%V$H$$$$!"$B%^%H%j%g!<%7%+?M7A(B$B$NJ}$,6a$$$+$b!#$I$&$;%W%m%0%i%_%s%0$r$d$k$J$i!"%j%+!<%7%V$rCN$i$J$$$G:Q$^$;$k

$B!!$7$+$7%j%+!<%7%V$r;H$&$K$O$A$g$C$H$7$?%F%/%K%C%/$,I,MW$J$N$G!"$3$3$G3,>h$N%W%m%0%i%`$rNc$K2r@b$7$F$*$3$&!#(B

$B3,>h$N7W;;(B

$B!!?t3X$N652J=q$K$"$k!V=gNs$HAH$_9g$o$;!W$N$H$3$m$G=P$F$/$k(Bn!$B$N$3$H$G$"$k$,!"$^$@3X9;$G=,$C$F$$$J$$?M$N$?$a$K<0$r=q$$$F$*$/!#(B

 n! = n $B!_(B (n-1) $B!_(B (n-2) $B!_(B $B!D(B $B!_(B 1

$B!!$D$^$j!"#3$N3,>h$J$i(B 3! = 3 $B!_(B 2 $B!_(B 1 = 6 $B$H$J$j!"#4$N3,>h$J$i(B 4! = 4 $B!_(B 3 $B!_(B 2 $B!_(B 1 = 24 $B$H$J$k$o$1$G!"A[A|$,$D$/$H;W$&$,!"(B $B$Y$->h(B$B$h$jAa$/Bg$-$/$J$C$F$$$/!#(B

$B!!G$0U$N?t#n$N3,>h$r5a$a$k%=!<%9%3!<%I$ONc$($P$3$s$JIw$K$J$k!#(B

#include <stdio.h>
unsigned long factorial(int n);

void main() {
	int n;
	unsigned long ans;
	
	printf("$B3,>h$N7W;;!'(B");
	scanf("%d", &n);
    
	ans = factorial(n);
	printf("%d$B$N3,>h(B=%lu\n", n, ans);
        
}

/* $B3,>h$r5a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X?t$O8F$P$l$k$?$S$K>u67$,JQ2=$7$F$*$j!"A02s8F$P$l$?$H$-$NCM$r3P$($F$*$/$?$a$K$O!"(Bstatic$BJQ?t$,I,MW$H$J$k!#(B

$BNc$($P!"O"7k%j%9%H$G9=@.$5$l$?:BI8CM$N%j%9%H$,$"$k$H$7$h$&!#:BI8$r=g$KD4$Y$F$$$C$F!"-!$H-#$r7k$V@~>e$K-"$,$"$C$?>l9g!"(B $B-"$r:o=|$7$F%j%9%H$r7R$.$+$($k4X?t$r:n$k$H$-!"%j%+!<%7%V$r;H$&$J$i$P!"2<5-$N$h$&$J%m%8%C%/$K$J$k!#(B($BD>@~H=DjIt$O>JN,(B)

typedef struct COOD {
	float x, y;
	struct COOD *next;
} COOD;

void shortcut(COOD *cood) {
	COOD *next, *next2;
	float a1, a2, b1, b2;
	
	next = cood->next;
	next2 = next->next;
	if (!next2) return;	/* 2$B$D@h$,$J$1$l$P=*N;(B */
	
	if(/* $BD>@~>e$@$C$?$i(B */) {
		cood->next = next2;
		free(next);
		shortcut(cood);	/* $B:F=hM}(B*/
	}
	else {
		shortcut(next);	/* $B
  

$B!!$7$+$7!"$3$l$,JD$8$F$$$k?^7A$@$C$?$i$I$&$@$m$&!#:G8e$N:BI8$N(Bnext$B$O!":G=i$N:BI8$r;X$7$F$$$k!#=*N;>r7o$,$J$/!"$0$k$0$k2s$C$F$7$^$&!#$=$&$$$&$H$-$K(Bstatic$BJQ?t$N=PHV$G$"$k!#(B

void shortcut(COOD *cood) {
	COOD *next, *next2;
	static COOD *start = NULL;
	
	if (!start) start = cood;	/* $B@hF,:BI8$N5-21(B */
	
	next = cood->next;
	if (next == start) return;	/* $B@hF,$KLa$C$?$i=*N;(B */
	next2 = next->next;
	
	if(/* $BD>@~>e$@$C$?$i(B */) {
		cood->next = next2;
		free(next);
		shortcut(cood);	/* $B:F=hM}(B*/
	}
	else {
		shortcut(next);	/* $B
  

$B!!(Bstatic$BJQ?t$r;H$o$J$$$G$3$l$ro$K!V@hF,:BI8!W$rEO$5$M$P$J$i$J$$$,!"(B$B%j%+!<%7%V$G$3$l$r$d$C$F$O$$$1$J$$(B$B!#(B $B>e=R$N$H$*$j%9%?%C%/$O8B$i$l$F$*$j!"%j%+!<%7%V!&%3!<%k$K$*$$$F$O5.=EIJ$J$N$G$"$k!#$?$C$?0l$D$NCM$r6&M-$9$k$N$K!"Kh2s%9%?%C%/$r>CHq$9$k$N$O!"L5BL8/$$$b$$$$$H$3$m$@!#(B $BI,MW:G>.8B$N$b$N$@$1%Q%i%a%?$GEO$9!"$=$l$,6K0U$G$"$k!#(B

$B%j%+!<%7%V!&%3!<%k(B
arrow $B > $BCN<1$N6L > $B%o%s%]%$%s%H(BTips >
KC