SeleniumのPageObjectパターンを学ぶ

SeleniumにおけるPageObjectパターンとは、ページを1つのオブジェクトとしてとらえるデザインパターンの1種のこと。 PageObjectパターンを使用してSeleniumを使ったテストスイートを構築することで、コードの重複化を防ぐことができる。 PageObjectパターン…

Codeforces Round #158 (Div. 2)

http://www.codeforces.com/contest/260 A,B問題だけ。 A. Adding Digits def op(a, b) for i in 0 .. 9 do c = a * 10 + i return c if c % b == 0 end -1 end a, b, n = gets.chomp.split(" ").map{|n| n.to_i} c = op(a, b) if c == -1 puts -1 else puts…

ボルダリング #2012inReview

今年の4~5月くらいにクライミングシューズ(スポルティバのコブラ)を買って、週1~2くらいのペースでジムに通ってた。 その甲斐あってか、体脂肪率が23%ぐらいから18%まで落ちた。体重は約7kg減。 よかったよかった。 ボルダリング自体の腕前は、4~5級の課…

Codeforces Round #156 (Div. 2)

http://www.codeforces.com/contest/255 A,B問題だけ。 A. Greg's Workout n = gets.chomp.to_i a = gets.chomp.split(" ").map{|n| n.to_i} chest = 0 biceps = 0 back = 0 0.step(n, 3) do |idx| chest += a[idx] if not a[idx].nil? biceps += a[idx + 1]…

Codeforces Round #154 (Div. 2)

http://www.codeforces.com/contest/253/ A,B問題だけ。 A. Boys and Girls 少年(B)と少女(G)の数がそれぞれ与えられる。 できるかぎり異性が隣合うようにしながら一列にならべる。 $stdin = File.open("input.txt") $stdout = File.open("output.txt", "w")…

Codeforces Round #152 (Div. 2)

http://www.codeforces.com/contest/248 またもA,B問題だけ解いた。 A. Cupboards 問題文を読み解くのに時間がかかった・・・。 左右のドアの開閉状況(Open = 1、Close = 0)が与えられる。 左右それぞれのドアをすべてOpen/すべてCloseで揃えるために必要な…

Codeforces Round #151 (Div. 2)

http://www.codeforces.com/contest/246 とりあえずA,B問題は解けた。 C~Eはこれから挑戦してみる。 A. Buggy Sorting n >= 2のとき以外は降順に整列した配列を出力すればいいだけ。 n = gets.chomp.to_i a = (1 .. n).to_a reverse = a.reverse if n <= 2 …

Codeforces Round #147 (Div. 2)

http://www.codeforces.com/contest/237 A,B問題だけ解けた。 A. Free Cash 同時刻に来店するお客の最大数を求めるだけ。 n = gets.chomp.to_i hash = {} n.times do v = gets.chomp if hash.has_key? v hash[v] += 1 else hash[v] = 1 end end puts hash.va…

Coderforces#137 (Div. 2 - A)

Rubyの勉強がてらにCodeforcesの問題を解いてみた。http://www.codeforces.com/contest/222/problem/A def solve(k, a) t = a[k - 1] # kより後ろの配列 other = a[k - 1 .. -1] other.each do |i| if i != t return -1 end end c = 0 (k - 1).downto(0) do …

Coderforces#139 (Div. 2 - A)

最近プログラミングしてなかったので、頭の体操がてらにCodeforcesの問題を解いてみた。 http://www.codeforces.com/contest/225/problem/A def solve(x, faces) faces.each do |a, b| if (a == b) or (a == x) or (b == x) or ((a + b) == 7) or ((a + x) =…

CoffeeScriptの内包表記を学ぶ

基本 arrayのループにはfor inを、objectsのループにはfor ofを使用する。 例 players = ["Jorge", "Leandro", "Tanaka"] for player in players console.log player # インデックスを含む場合 for player, index in players console.log "#{index}, #{playe…