競技プログラミングやめるやめる言ってたのに参加してしまった(意志が弱い
12位、1ページ目に載ったのは初めてです
1級になりました
A: Celsius と Fahrenheit - AtCoder Regular Contest #015 | AtCoder
摂氏の温度を華氏に変える、やるだけ
# -*- coding: utf-8 -*- import sys import collections N = int(raw_input()) print 9 / 5.0 * N + 32
B: 真冬日?真夏日? - AtCoder Regular Contest #015 | AtCoder
各温度の条件を満たす日数を答える、やるだけ
# -*- coding: utf-8 -*- import math import sys import datetime N = int(raw_input()) result = [0] * 6 for i in xrange(N): M, m = map(float, raw_input().split()) if 35 <= M: result[0] += 1 if 30 <= M < 35: result[1] += 1 if 25 <= M < 30: result[2] += 1 if 25 <= m: result[3] += 1 if m < 0 and 0 <= M: result[4] += 1 if M < 0: result[5] += 1 for i in result: print i,
C: 変わった単位 - AtCoder Regular Contest #015 | AtCoder
各単位をノードにして、同じ場所に通らないように適当に深さ優先探索
かけている数は適当に浮動小数点で持っておいて四捨五入したらなんかうまくいった
# -*- coding: utf-8 -*- import math import sys import collections N = int(raw_input()) route = collections.defaultdict(set) large = [1] small = [1] for i in xrange(N): l, n, r = raw_input().split() n = int(n) route[l].add((r, 1, n)) route[r].add((l, n, 1)) def search(current, visited, cur_m, cur_d): # print current, cur_m, cur_d for next, m, d in route[current]: if next not in visited: visited.add(next) score = cur_m / cur_d score *= m score /= d if score > large[0]: large[0] = score largest[0] = next if score < small[0]: small[0] = score smallest[0] = next search(next, visited, cur_m * m, cur_d * d) # visited.remove(next) first = route.keys()[0] largest = [first] smallest = [first] search(first, set([first]), 1.0, 1.0) #print large, small, int(round(large[0] / small[0])) print '1{}={}{}'.format(largest[0], int(round(large[0] / small[0])), smallest[0])
D: きんいろクッキー - AtCoder Regular Contest #015 | AtCoder
元ネタはCookie Clickerときんいろモザイク?
クッキーの期待値を答える
まったく手も足も出ず