HSP - Hot Soup Processor

このエントリーをはてなブックマークに追加
763デフォルトの名無しさん
sdim a,1000:a={"
+4:Oに  :+++++-
-1:Pんぐ :-

-2:724  :--
+1:ch  :+
"}
notesel a:notemax n:m=0:repeat n:noteget t,cnt:strlen l,t:if m<l:m=l
loop:sdim t,m+1,n+1:sdim u,m+1,n+1:dim s,n,2:repeat n:noteget t.cnt,cnt
strmid t.n,t.cnt,,2:s.cnt.0=0+t.n:s.cnt.1=cnt:instr i,t.cnt,":",4
peek u.cnt,t.cnt,i+6:loop:repeat n-1,1:repeat n-cnt:j=cnt+1:if s.cnt<s.j:goto*@f
if s.cnt!=s.j:continue
k=u.cnt!u.j:if s.cnt>0:if k<0:goto*@f:else:continue
if k>0:goto*@f:else:continue
*@:k=cnt:repeat 2:l=s.k.cnt:s.k.cnt=s.j.cnt:s.j.cnt=l:loop
u.n=u.cnt:u.cnt=u.j:u.j=u.n:loop:loop:repeat n:i=s.cnt.1:mes t.i:loop:stop
バブルソートでスマソ