This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'matrix' | |
# | |
# perceptron | |
# | |
@data=[] | |
@dim=3 | |
@eta=0.75 | |
# read data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#---------------------- | |
#ロジスティック回帰 | |
require "matrix" | |
def sigmoid(x) | |
1.0/(1.0+Math::exp(-x)) | |
end | |
class LearnLogistic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://d.hatena.ne.jp/Ozy/20160202 | |
long long a=1,b[9],s;main(z){for(;99+z;a=(b[z&3]+=a)-a+b[--z&3])printf("%lld\n",s+=a);} | |
// 2016/02/20 02:00 追記 | |
long long a=1,b[9],s; // a以外は0で初期化される | |
int main(){ | |
int z=1; // 引数argc=1 | |
for(;99+z != 0 ;){ | |
printf("%lld\n",s+=a); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
exe=ARGV[0] | |
findex = open("./test/index.txt"); | |
while cin = findex.gets | |
din,dout=cin.chomp.split(",") | |
fout=open("./test/"+dout) | |
puts "|"+exe+" < "+din | |
res=nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
オプション: | |
Dを付与して実行するとログをオエーする | |
example :: codevs D < stdin.txt 2> out.log | |
Rを付与して実行するとパラメータにランダム要素が加わる | |
DとRは重複できない。 | |
コンパイラ: | |
VS2013 x64 (cl /EHsc /O2 codevs.cpp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
オプション: | |
Dを付与して実行するとログをオエーする | |
example :: codevs D < stdin.txt 2> out.log | |
Rを付与して実行するとパラメータにランダム要素が加わる | |
DとRは重複できない。 | |
コンパイラ: | |
VS2013 x64 (cl /EHsc /O2 codevs.cpp) | |
cygwinのg++4.9.3でもコンパイルは通るように 実行は未検証 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
オプション: | |
Dを付与して実行するとログをオエーする | |
example :: codevs D < stdin.txt 2> out.log | |
Rを付与して実行するとパラメータにランダム要素が加わる | |
Tを付与して実行すると攻撃、防衛しない。 | |
Uを付与して実行すると攻撃しない。 | |
T,Uは重複できない。 | |
コンパイラ: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.swing.*; | |
import java.awt.*; | |
import java.awt.event.*; | |
public class Test extends JFrame{ | |
public static void main(String arg[]){ | |
new Test(); | |
} | |
Panel cardPanel; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# 書き込み可能有限オートマトン | |
# WW^Rを受理する (w in {1,2,3}) | |
# | |
# OK 12311321 | |
# OK 2222 | |
# NG 123123 | |
@tape=("$"+gets.chomp+"&").chars.to_a | |
@pos=1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@n=59 | |
range=(1..(@n-1)).to_a.reject{|e|e.even?} | |
@maze=Array.new(@n){Array.new(@n){'#'}} | |
@n.times{|y| | |
@n.times{|x| | |
@maze[x][y]="$" if x==0||y==0||x==@n-1||y==@n-1 | |
} | |
} |
OlderNewer