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
# SRM 647 Div2 Easy | |
# http://community.topcoder.com/stat?c=problem_statement&pm=13632 | |
class PeacefulLine(): | |
def makeLine(self, x): | |
d = {} | |
for i in x: | |
if i in d.keys(): | |
d[i] += 1 | |
else: |
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
# SRM 648 Div2 Easy | |
#http://community.topcoder.com/stat?c=problem_statement&pm=13650 | |
class KitayutaMart2(): | |
def numBought(self, k, t): | |
n = 1 | |
ksum = k | |
while True: | |
if ksum == t: | |
return n | |
n += 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
# SRM 671 Div2 Easy | |
# [Very short Editorial of SRM #671 - Codeforces](http://codeforces.com/blog/entry/20939) | |
class BearPaints(): | |
def maxArea(self, w, h, m): | |
area = 1 | |
for i in range(1,w+1): | |
area = max(area, i * min(m/i, h)) | |
return area |
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
# SRM 672 Div2 Easy | |
class SetPartialOrder(): | |
def compareSets(self, a, b): | |
seta = set(a) | |
setb = set(b) | |
if seta == setb: | |
return "EQUAL" | |
elif seta.issubset(setb): | |
return "LESS" | |
elif setb.issubset(seta): |
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
l = gets.chomp.to_i | |
n = gets.chomp.to_i | |
w = gets.chomp.split(" ").map(&:to_i) | |
w.sort! | |
ww = 0 | |
i = 0 | |
w.each do |a| | |
ww += a | |
if ww > l then | |
break |
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
# [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
// ==UserScript== | |
// @name getExampleCasesInCodeforces | |
// @namespace what_alnk | |
// @description Codeforcesの入力例と出力例をコピーするボタンを設置する | |
// @include /^http://codeforces\.com/contest/\d{3}/problem/[0-9A-E]$/ | |
// @version 1.2.1 | |
// @grant none | |
// ==/UserScript== | |
// 通知 |