$B$3$N%I%-%e%a%s%H$O(B http://edu.net.c.dendai.ac.jp/ $B>e$G8x3+$5$l$F$$$^$9!#(B
$BE4F;$dF;O)$N=jMW;~4V$,$o$+$C$F$$$k;~!"$"$kET;T$+$iJL$NET;T$X$N:GC;$N7P(B $BO)$r5a$a$kLdBj$r9M$($^$7$g$&!#(B $B$3$l$O%+!<%J%S%2!<%7%g%s%7%9%F%`$dE4F;$N>h$j49$(0FFb$J$I$K1~MQ$G$-$kLd(B $BBj$G$9!#(B $BNc$($Pu67$r9M$($^$7$g$&!#(B $BEl5~EE5!Bg3X$+$i=BC+$K9T$/$N$KJ#?t$N7PO)$,9M$($i$l$^$9!#(B $B$3$3$G$O
$B$3$l$i$N4X78$r9TNs$GI=$9$3$H$r9M$($^$9!#(B $B9T$HNs$r$=$l$>$l$NCOE@$KBP1~$5$;!"[email protected],$K$O$*$*$h$=$N=jMW;~4V$rF~$l$^(B $B$9!#$^$?D>@\9T$1$J$$COE@4X$O!g$GI=$7$^$9!#(B $B4JC1$N$?$a$KD>@\9T$1$F$b!g$GI=$7$F$$$k$H$3$m$b$"$j$^$9!#(B $B0lJ}!">h49$(;~4V$O=EMW$G$9$,!"4JC1$N$?$a$K$3$3$G$OL5;k$7$^$9!#(B
$BEE5!Bg(B | $B?7$*Cc$N?e(B | $BBg$B$*Cc$N?e(B
| $B?@ED(B
| $BI=;2F;(B
| $BBe!9LZ(B
| $B86=I(B
| $B=BC+(B
| | ||
---|---|---|---|---|---|---|---|---|---|---|
$BEE5!Bg(B | - | 5 | 13 | 15 | 10 | 10 | $B!g(B | $B!g(B | $B!g(B | $B!g(B |
$B?7$*Cc$N?e(B | 5 | - | 3 | $B!g(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B |
$BBg3 | - | 3 | $B!g(B | $B!g(B | 12 | $B!g(B | $B!g(B | $B!g(B
| | |
$B?@J]D.(B | 15 | $B!g(B | 3 | - | $B!g(B | $B!g(B | 11 | $B!g(B | $B!g(B | $B!g(B |
$B$*Cc$N?e(B | 10 | $B!g(B | $B!g(B | $B!g(B | - | 3 | $B!g(B | 13 | $B!g(B | $B!g(B |
$B?@ED(B | 10 | $B!g(B | $B!g(B | $B!g(B | 3 | - | $B!g(B | $B!g(B | $B!g(B | 25 |
$BI=;2F;(B | $B!g(B | $B!g(B | 12 | 11 | $B!g(B | $B!g(B | - | $B!g(B | 3 | 3 |
$BBe!9LZ(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | 13 | $B!g(B | $B!g(B | - | 3 | $B!g(B |
$B86=I(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | 3 | 3 | - | 2 |
$B=BC+(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | $B!g(B | 25 | 3 | $B!g(B | 2 | - |
$B$3$N$h$&$J>u67$G$I$N7PO)$,:GC;$+$r7W;;$5$;$k%W%m%0%i%`$r:n$j$^$7$g$&!#(B $B$3$3$G>R2p$9$kJ}K!$O(B$B%@%$%/%9%H%iK!(B$B$H8F$P$l$k$b$N$G$9!#(B $B$3$NJ}K!$G$OEE5!Bg$+$i$9$Y$F$N1X$X$N=jMW;~4V$,5a$^$j$^$9!#(B
#include <stdio.h>
#define NUM 10
#define HI_VALUE 9999
char *eki[NUM]={"$BEE5!Bg(B","$B?7$*Cc$N?e(B","$BBg
$B$3$3$G!"(B path[] $BJQ?t$K$O!"EE5!Bg$+$iMh$k>l9g$KD>A0$K7PM3$7$?1X$rF~$l$^$9!#(B $B$=$&$9$k$H!":GC;O)$,8+$D$+$C$?>l9g!"L\E*CO$+$i=g$KEE5!Bg$^$G:GC;7PO)$r$?(B $B$I$k$3$H$,$G$-$^$9!#(B
$B$3$N9V5A$N
$BBgNL$N%G!<%?$r07$&$K$O!"$"$i$+$8$aMFNL$r7h$a$J$1$l$P$$$1$J$$G[Ns$O;H$((B
$B$^$;$s!#$=$3$G;HMQ$7$?$N$,@~7A%j%9%H$H$$$&%G!<%?9=B$$G$9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