七行プログラミング (452レス)
上下前次1-新
抽出解除 レス栞
リロード規制です。10分ほどで解除するので、他のブラウザへ避難してください。
4(5): nobodyさん [] 02/11/01 18:39 ID:oU5vKkbM(1) AAS
とりあえず7行でカウンタを作ろう
166(1): 保守 [sage] 03/10/04 05:54 ID:??? AAS
$$_=1for"@ARGV"=~/\w/g;for('0019'..9999){my%c;$n=$_;next if$h{"@{[sort@v=/./g]}
"}++&&$o||$z&&/0/||$d&&(grep$c{$_}++,@v);O:for(map[@{[qw(+ - * /)]}[$_&3,$_>>2&
3,$_>>4&3]],0..63){@x=(@$_,@v);eval==10&&do{print"$n:$_\n";$c&&last O}for grep
s/(\d)/$x[$1]/g,qw/(304)1(526) ((304)15)26 30(41(526)) 30((415)26) (30(415))26/
}}
167: nobodyさん [sage] 03/10/05 03:33 ID:??? AAS
本家スレで出てた切符問題の CGI プログラム版。
選択された4つの数字のみを調べる。
#!/usr/local/bin/perl
use CGI':all';@n=param n;for(map[@{[qw(+ - * /)]}[$_&3,$_>>2&3,$_>>4&3]],0..63)
{@x=(@$_,@n);for$t(qw/(304)1(526) ((304)15)26 30(41(526)) 30((415)26)/,'(30(41'
.'5))26'){$_=$t;s/(\d)/$x[$1]/g;eval==10&&push@e,$_.br}}put header,start_html(
-title=>7410),startform(0,script_name),p(scrolling_list(qw(-name n -size 10),
-values=>[0..9])x4,submit),endform,p(@e),end_html
>>166 は 5.005_03 なら動いたけど 5.8.0 だと不可。
168: nobodyさん [sage] 03/10/05 20:23 ID:??? AAS
コマンドライン・CGI 両対応版。
#--- 7410.cgi ---
#!/usr/local/bin/perl
use CGI':all';sub e{for(map[@{[qw(+ - * /)]}[$_&3,$_>>2&3,$_>>4&3]],0..63){@x=(
@$_,@n);for$t(qw/(304)1(526) ((304)15)26 30(41(526)) 30((415)26) (30(415))26/){
$_=$t;s/(\d)/$x[$1]/g;eval==10&&do{$r?push@e,$_.br:print"$n:$_\n";$c&&return}}}
@e}if($r=$ENV{'REMOTE_ADDR'}){@n=param n;put header,start_html(-title=>7410),
startform(0,script_name),p(scrolling_list(qw(-name n -size 10 -values),[0..9])x
4,submit),endform,p(e),end_html}else{$$_=1for"@ARGV"=~/\w/g;$n=$_,$h{"@{[sort@n
=/./g]}"}++&&$o||$z&&/0/||$d&&do{my%c;grep$c{$_}++,@n}or e for'0019'..9999}
__END__
usage: ./7410.cgi [ -cdoz ]
-c : 1組の数字に対し1つの計算式のみ出力
-d : 同じ数字を使わない
-o : 1組の数字に対し1つの出現順序のみ出力
-z : 0を含めない
169: nobodyさん [sage] 03/10/08 01:14 ID:??? AAS
5.005_03 と 5.8.0 の両方でマジメにチェック & 縮め。
#!/usr/local/bin/perl
use CGI':all';sub e{my@e;for(0..63){@x=(@{[qw(+ - * /)]}[$_&3,$_>>2&3,$_>>4&3],
@n,param n);for$t(qw/(304)1(526) ((304)15)26 30(41(526)) 30((415)26)
(30(415))26/){$_=$t;s/(\d)/$x[$1]/g;10-eval or$r?push@e,$_.br:put("$n:$_\n"),$c
&&return}}@e}($r=$ENV{REMOTE_ADDR})?put(header,start_html(-title=>7410),
startform(0,script_name),p(scrolling_list(-values=>[0..9],name,n,size,10)x4,
submit),endform,p(e),end_html):do{$$_=1for"@ARGV"=~/\w/g;$n=$_,$h{"@{[sort@n=
/./g]}"}++&&$o||$z&&/0/||$d&&4>keys%{{map{$_,1}@n}}or e for'0019'..'9999'}
240(1): nobodyさん [sage] 04/02/12 06:42 ID:??? AAS
転載
#!/usr/bin/perl -w
# 526-byte qrpff, Keith Winstein and Marc Horowitz <sipb-iap-dvd@mit.edu>
# MPEG 2 PS VOB file on stdin -> descrambled output on stdout
# arguments: title key bytes in least to most-significant order
$_='while(read+STDIN,$_,2048){$a=29;$c=142;if((@a=unx"C*",$_)[20]&48){$h=5;
$_=unxb24,join"",@b=map{xB8,unxb8,chr($_^$a[--$h+84])}@ARGV;s/...$/1$&/;$d=
unxV,xb25,$_;$b=73;$e=256|(ord$b[4])<<9|ord$b[3];$d=$d>>8^($f=($t=255)&($d
>>12^$d>>4^$d^$d/8))<<17,$e=$e>>8^($t&($g=($q=$e>>14&7^$e)^$q*8^$q<<6))<<9
,$_=(map{$_%16or$t^=$c^=($m=(11,10,116,100,11,122,20,100)[$_/16%8])&110;$t
^=(72,@z=(64,72,$a^=12*($_%16-2?0:$m&17)),$b^=$_%64?12:0,@z)[$_%8]}(16..271))
[$_]^(($h>>=8)+=$f+(~$g&$t))for@a[128..$#a]}print+x"C*",@a}';s/x/pack+/g;eval
上下前次1-新書関写板覧索設栞歴
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.029s