[過去ログ] プログラミングのお題スレ Part13 (1002レス)
上下前次1-新
抽出解除 レス栞
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
888(6): さすらいの蟻人間 ◆T6xkBnTXz7B0 2019/05/10(金)14:51 ID:CF7UUf9v(1)調 AAS
お題: >>877 の入出力を逆転。
889: 2019/05/10(金)15:12 ID:bODSyEKx(1)調 AAS
>>888 手抜きすんな面白くない
918: 2019/05/16(木)14:34 ID:YVMjr/q8(2/2)調 AAS
>>888
Go
https://ideone.com/x2iyka
928: 2019/05/17(金)00:26 ID:SI3/qEwo(1)調 AAS
>>888 Pharo/Squeak Smalltalk
| fn |
fn := [:arr |
String streamContents: [:ss |
| cIdx lIdx |
cIdx := lIdx := 0.
arr do: [:spec |
spec third > lIdx ifTrue: [
ss nextPutAll: (String new: spec third - lIdx withAll: Character cr).
lIdx := spec third.
cIdx := 0
].
ss nextPutAll: (String new: spec second - cIdx withAll: Character space).
ss nextPutAll: spec first.
cIdx := spec second + 1.
]
]
].
fn value: #(
(a 0 0)
(b 2 0)
(c 4 0)
(d 0 2)).
"=>
a b c
d "
932(1): 2019/05/17(金)07:54 ID:9a+COZnd(1/3)調 AAS
>>888
s = '''\
[a, 0, 0]
[b, 2, 0]
[c, 4, 0]
[d, 0, 2]
'''
from parse import * #pip install
col2 = 0 ; line2 = 0
for l in s.splitlines():
col = col2 ; line = line2
r=parse('[{},{},{}]',l)
c= r[0]
col2 = int(r[1]) ; line2 = int(r[2])
{print() for _ in range(line2-line) }
{print(' ',end='') for _ in range(col2-col)}
print(c, end='')
col2 += 1
print()
'''#出力
a b c
d
'''
933: 2019/05/17(金)08:32 ID:9a+COZnd(2/3)調 AAS
>>932 parse に型指定追加
>>888 Python
s = '''\
[a, 0, 0]
[b, 2, 0]
[c, 4, 0]
[d, 0, 2]
'''
from parse import * #pip install
col2 = 0 ; line2 = 0
for l in s.splitlines():
col = col2 ; line = line2
(c,col2,line2) = parse('[{},{:d},{:d}]',l)
{print() for _ in range(line2-line) }
{print(' ',end='') for _ in range(col2-col)}
print(c, end='')
col2 += 1
print()
'''#出力
a b c
d
'''
989: 2019/05/18(土)15:45 ID:kdcwh9zo(1)調 AAS
>>888 Perl5
@a=([a, 0, 0],
[b, 2, 0],
[c, 4, 0],
[d, 0, 2]);
sub {$t[$_[2]][$_[1]] = $_[0]}->(@$_) for @a;
@b = map{[map{$_ // ' '} @$_]} map{[@$_]} @t;
undef $";
$s = join'', map{"@$_\n"} @b;
print $s;
実行
~ $ perl 13_888.pl
a b c
d
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.036s