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
# [Problem - 592A - Codeforces](http://codeforces.com/problemset/problem/592/A) | |
field = [] | |
while line = gets | |
field << line.chomp.split("") | |
end | |
field = field.transpose | |
stepA = [] | |
stepB = [] | |
field.each do |r| | |
a = r.rindex("W") |
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
# [Problem - A - Codeforces](http://codeforces.com/contest/593/problem/A) | |
n = gets.chomp.to_i | |
d = Hash.new(0) | |
n.times do | |
word = gets.chomp | |
k = word.split("").uniq.sort | |
v = word.length | |
d[k] += v if k.length <= 2 | |
end | |
res = 0 |
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
# #325 Div2 A. Alena's Schedule | |
n = gets.chomp.to_i | |
a = gets.chomp.split(" ").map(&:to_i) | |
lesson = 0 | |
rest = 0 | |
a.each do |i| | |
if i == 1 then | |
if rest == 1 and lesson > 0 then | |
lesson += 1 | |
end |
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
# [A: ダブル文字列/Double String - CODE FESTIVAL 2015 予選B | AtCoder](http://code-festival-2015-qualb.contest.atcoder.jp/tasks/codefestival_2015_qualB_a) | |
s = gets.chomp | |
puts s.split("").uniq.join("")*2 |
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
// ==UserScript== | |
// @name getExampleCases | |
// @namespace what_alnk | |
// @description AtCoderの入力例と出力例をコピーするボタンを設置する | |
// @include /^http://[0-9a-zA-Z]+\.contest\.atcoder\.jp/tasks/[A-D]/ | |
// @version 1.2 | |
// @grant none | |
// ==/UserScript== | |
// 通知許可確認 |
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
# [Problem - A - Codeforces](http://codeforces.com/contest/595/problem/A) | |
n, m = gets.chomp.split(" ").map(&:to_i) | |
ans = 0 | |
n.times do |i| | |
rooms = gets.chomp.split(" ").map(&:to_i) | |
rooms.each_slice(2) do |a, b| | |
if (a == 1) or (b == 1) then | |
ans += 1 | |
end | |
end |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# All Vagrant configuration is done below. The "2" in Vagrant.configure | |
# configures the configuration version (we support older styles for | |
# backwards compatibility). Please don't change it unless you know what | |
# you're doing. | |
$forbuild = <<SCRIPT | |
apt-get update -y | |
apt-get install -y git |
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
from collections import defaultdict | |
class BearSong(): | |
def countRareNotes(self, notes): | |
d = defaultdict(int) | |
for i in notes: | |
d[i] += 1 | |
return(len([i for i in d.values() if i == 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
t = gets.chomp.to_i | |
t.times do | |
n = gets.chomp.to_i | |
power2 = [] | |
snd = 1 | |
i = 1 | |
while snd <= n | |
power2 << snd | |
snd = 2**i | |
i += 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 = gets.chomp.to_i | |
coors = [] | |
n.times do | |
coors << gets.chomp.split(" ").map(&:to_i) | |
end | |
if n == 3 or n == 4 then | |
coors_t = coors.transpose | |
dx = coors_t[0].max - coors_t[0].min | |
dy = coors_t[1].max - coors_t[1].min | |
puts dx * dy |