2010-10-30から1日間の記事一覧

Codeforces Beta Round #38 E. Let's Go Rolling!

Let's Go Rolling!動的計画法。ビー玉の位置でソートして、左から順に、ビー玉をある位置で止めるときに必要な金を求める。 #include <iostream> #include <vector> #include <utility> #include <algorithm> using namespace std; int main() { int n; cin >> n; vector<pair<int,int> > m(n); for ( int i=0; i<n; i++ ) cin >></n;></pair<int,int></algorithm></utility></vector></iostream>…

Codeforces Beta Round #38 D. Vasya the Architect

Vasya the Architect積み上げたレンガの重心が下のレンガの外側にあると塔が崩れる。引っかかりどころがたくさん。 誤差が怖いので整数で計算。 入力がx1>x2という場合もある。 レンガは1つずつ積む。例えば↓の入力は3個目のレンガを乗せれば安定するけど、2…

Codeforces Beta Round #38 C. Blinds

Blinds長さxの帯が何本切り取れるかをxの値を変えながら調べる。 n,l = map(int,raw_input().split()) a = map(int,raw_input().split()) ans = 0 for x in range(l,max(a)+1): ans = max(ans,sum([t/x*x for t in a])) print ans

Codeforces Beta Round #38 B. Chess

Chess全ての置き場所を試しても余裕で間に合う。 t = raw_input() r = (ord(t[0])-ord("a"))+(ord(t[1])-ord("1"))*1j t = raw_input() k = (ord(t[0])-ord("a"))+(ord(t[1])-ord("1"))*1j move = [-1+2j,1+2j,2+1j,2-1j,1-2j,-1-2j,-2-1j,-2+1j] c = 0 for …

Codeforces Beta Round #38 A. Army

Army input() d = map(int,raw_input().split()) a,b = map(int,raw_input().split()) print sum(d[a-1:b-1])

Codeforces Beta Round #38

A + 00:06 B + 00:22 C +1 00:42 D +6 03:28 E +1 01:10 結果 109位 1681 → 1745 Dにハマったのが痛かったが、レーティング上がったし満足。