<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
	<channel>
		<title>도장</title>
		<link>http://dojo.janbyul.com/</link>
		<description>직접 작성한 각종 언어의 코드 기록. 공개.
學文如逆水行舟不進卽退</description>
		<language>ko</language>
		<pubDate>Wed, 17 Aug 2011 14:58:07 +0900</pubDate>
		<generator>Tistory 1.1 (http://www.tistory.com/)</generator>
		<image>
		<title>도장</title>
		<url><![CDATA[http://cfs6.tistory.com/upload_control/download.blog?fhandle=YmxvZzE3ODgxNUBmczYudGlzdG9yeS5jb206L2F0dGFjaC8wLzE3MDAwMDAwMDAwMS5wbmc%3D]]></url>
		<link>http://dojo.janbyul.com/</link>
		<description>직접 작성한 각종 언어의 코드 기록. 공개.
學文如逆水行舟不進卽退</description>
		</image>
		<item>
			<title>permutations</title>
			<link>http://dojo.janbyul.com/26</link>
			<description>&lt;br /&gt;
&lt;div style=&quot;border: 1px dashed rgb(243, 197, 52); padding: 10px; background-color: rgb(254, 254, 184);&quot; class=&quot;txc-textbox&quot;&gt;&lt;br /&gt;
from __future__ import generators&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
def xcombinations(items, n):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if n==0: yield []&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; else:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for i in range(len(items)):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for cc in xcombinations(items[:i]+items[i+1:],n-1):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield [items[i]]+cc&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
def xpermutations(items):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; return xcombinations(items, len(items))&lt;br /&gt;
&lt;br /&gt;if __name__==&#039;__main__&#039;:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;&#039;&#039;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for p in xpermutations([&#039;0&#039;,&#039;1&#039;,&#039;2&#039;,&#039;3&#039;]):&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print (&#039;&#039;.join(p))&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; arr = xpermutations([&#039;0&#039;,&#039;1&#039;,&#039;2&#039;,&#039;3&#039;])&lt;br /&gt;
&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(&#039;indices[24][4]={&#039;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; for item in arr:&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; form = &#039;{%s,%s,%s,%s},&#039; % (item[0], item[1], item[2], item[3])&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; print(form)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; print(&#039;}&#039;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
compatible with python 3.x+&lt;br /&gt;</description>
			<category>Python</category>
			<author>DamienRice</author>
			<guid>http://dojo.janbyul.com/26</guid>
			<comments>http://dojo.janbyul.com/26#entry26comment</comments>
			<pubDate>Tue, 26 May 2009 00:07:34 +0900</pubDate>
		</item>
		<item>
			<title>Code Golf - Choose</title>
			<link>http://dojo.janbyul.com/25</link>
			<description>&lt;a title=&quot;[http://codegolf.com/choose]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://codegolf.com/choose&quot;&gt;원문&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dashed rgb(243, 197, 52); padding: 10px; background-color: rgb(254, 254, 184);&quot; class=&quot;txc-textbox&quot;&gt;
def c(t):&lt;br /&gt;
&amp;nbsp;s=1&lt;br /&gt;
&amp;nbsp;for i in range(1,t[1]+1):&lt;br /&gt;
&amp;nbsp; s=s*(t[0]-i+1)/i&lt;br /&gt;
&amp;nbsp;print s&lt;br /&gt;
c(input())&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
내 사이즈는 87바이트. 포럼을 보니 파스칼 삼각형을 이용하는 방법도 있는것 같은데. 1등은 39바이트. 내 코드의 반도 안된다. 어떻게한거지?&lt;br /&gt;
&lt;br /&gt;
&lt;div style=&quot;border: 1px dashed rgb(243, 197, 52); padding: 10px; background-color: rgb(254, 254, 184);&quot; class=&quot;txc-textbox&quot;&gt;def c(t,s):&lt;br /&gt;
&amp;nbsp;for i in range(1,t[1]+1):&lt;br /&gt;
&amp;nbsp; s=s*(t[0]-i+1)/i&lt;br /&gt;
&amp;nbsp;print s&lt;br /&gt;
c(input(),1)&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;1바이트를 줄여 86바이트가 되었다.&lt;br /&gt;</description>
			<category>Python</category>
			<category>Code Golf</category>
			<category>코드골프</category>
			<author>DamienRice</author>
			<guid>http://dojo.janbyul.com/25</guid>
			<comments>http://dojo.janbyul.com/25#entry25comment</comments>
			<pubDate>Fri, 06 Feb 2009 08:24:08 +0900</pubDate>
		</item>
		<item>
			<title>Saving-time (python)</title>
			<link>http://dojo.janbyul.com/24</link>
			<description>&lt;a title=&quot;[http://codegolf.com/saving-time]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://codegolf.com/saving-time&quot;&gt;링크&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;첫 번째 코드 : 290바이트. 전체 61위 (2008.12.12. 오전 10시 현재)&lt;br /&gt;
&lt;div style=&quot;border: 1px dashed rgb(243, 197, 52); padding: 10px; background-color: rgb(254, 254, 184);&quot; class=&quot;txc-textbox&quot;&gt;s=&#039; &#039;&lt;br /&gt;
o=&#039;o&#039;&lt;br /&gt;
n=&#039;\n&#039;&lt;br /&gt;
c=[s*8,o,n,s*4,o,s*7,o,n,n,s,o,s*13,o,n,n,o,s*15,o,n,n,s,o,s*13,o,n,n,s*4,o,s*7,o,n,s*8,o]&lt;br /&gt;
i=[1,6,12,17,23,29,32,27,21,15,10,4]&lt;br /&gt;
a = raw_input().split(&#039;:&#039;)&lt;br /&gt;
h=i[int(a[0])%12]&lt;br /&gt;
m=i[int(a[1])/5]&lt;br /&gt;
c[h]=&#039;h&#039;&lt;br /&gt;
if h==m:c[m]=&#039;x&#039;&lt;br /&gt;
else: c[m]=&#039;m&#039;&lt;br /&gt;
print &#039;&#039;.join(k for k in c)&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
- 출력되는 시계모양을 정의하는 코드사이즈를 줄이는데 치중했음&lt;br /&gt;
- 시계모양의 텍스트에서 어떤 패턴을 발견하면 더 줄일 수 있지 않을까 생각중.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;</description>
			<category>Python</category>
			<category>Code Golf</category>
			<author>DamienRice</author>
			<guid>http://dojo.janbyul.com/24</guid>
			<comments>http://dojo.janbyul.com/24#entry24comment</comments>
			<pubDate>Fri, 12 Dec 2008 10:14:50 +0900</pubDate>
		</item>
		<item>
			<title>Jolly Jumpers</title>
			<link>http://dojo.janbyul.com/23</link>
			<description>&lt;a title=&quot;[http://inyourheart.biz/zerowiki/wiki.php/JollyJumpers]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://inyourheart.biz/zerowiki/wiki.php/JollyJumpers&quot;&gt;&lt;a title=&quot;[http://online-judge.uva.es/p/v100/10038.html]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://online-judge.uva.es/p/v100/10038.html&quot;&gt;원문&lt;/a&gt;&lt;/a&gt;, &lt;a title=&quot;[http://inyourheart.biz/zerowiki/wiki.php/JollyJumpers]로 이동합니다.&quot; target=&quot;_blank&quot; href=&quot;http://inyourheart.biz/zerowiki/wiki.php/JollyJumpers&quot;&gt;번역문&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;&lt;div style=&quot;border: 1px dashed rgb(243, 197, 52); padding: 10px; background-color: rgb(254, 254, 184);&quot; class=&quot;txc-textbox&quot;&gt;
% 리스트에서 인접한 값의 차가 들어있는 리스트를 sort 해서 리스트 원소의 합과 가우스 합(?)을 비교.&lt;br /&gt;
% io 부분 추가해야 함.&lt;br /&gt;
-module(jolly).&lt;br /&gt;
-compile(export_all).&lt;br /&gt;
&lt;br /&gt;jolly([H|T]) -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; jollyResult([H|T], lists:usort(jollySub(H, T, []))).&lt;br /&gt;
&lt;br /&gt;jollyResult(Ori, Res) -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; case (length(Ori)-1 =:= length(Res) andalso lists:sum(Res) =:= trunc((hd(Res)+lists:last(Res))*length(Res)/2)) of&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; true -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; io:format(&quot;Jolly~n&quot;);&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; false&amp;nbsp; -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; io:format(&quot;Not Jolly~n&quot;)&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; end.&lt;br /&gt;
&lt;br /&gt;%앞의 것과 뒤의 아이템을 빼서 새 리스트에 더함..&lt;br /&gt;
jollySub(H, [], Res) -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; Res;&lt;br /&gt;
jollySub(H, [HH|T], Res) -&amp;gt;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; jollySub(HH, T, Res++[abs(H-HH)]).&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;</description>
			<category>Erlang</category>
			<author>DamienRice</author>
			<guid>http://dojo.janbyul.com/23</guid>
			<comments>http://dojo.janbyul.com/23#entry23comment</comments>
			<pubDate>Thu, 13 Nov 2008 09:52:28 +0900</pubDate>
		</item>
		<item>
			<title>Programming Erlang Chapter 08. Problems</title>
			<link>http://dojo.janbyul.com/22</link>
			<description>1. Write a function start(AnAtom, Fun) to register AnAtom as spawn(Fun). Make sure your program works correctly in the case when two parallel processes simultaneously evaluate start/2. In this case, you must guarantee that one of these processes succeeds and the other fails.&lt;br /&gt;
- spawn(Fun)을 AnAtom으로 등록하는 start(AnAtom, Fun)함수를 작성하라. 병렬 프로세스 두 개가 동시에 start/2를 평가할 경우에 제대로 작동하는지 확인하자. 이 경우, 이 프로세스중 하나는 성공, 다른 하나는 실패가 되어야 한다.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;2. Write a ring benchmark. Create N processes in a ring. Send a message round the ring M times so that a total of N * M messages get sent. Time how long this takes for different values of N and M. Write a similar program in some other programming language you are familiar with. Compare the results. Write a blog, and publish the results on the Internet!&lt;br /&gt;
- 링(ring) 벤치마크를 작성하라. 링에 프로세스를 N개 생성하자. 링을 돌며 M번 메시지를 보내 총 N*M개의 메시지를 보내자. N과 M에 여러 다른 값을 주어 얼마나 걸리는지 시간을 재자.&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;</description>
			<category>Erlang</category>
			<author>DamienRice</author>
			<guid>http://dojo.janbyul.com/22</guid>
			<comments>http://dojo.janbyul.com/22#entry22comment</comments>
			<pubDate>Tue, 11 Nov 2008 08:48:53 +0900</pubDate>
		</item>
	</channel>
</rss>

