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

Codeforces Beta Round #45 D. Permutations

Permutationsxの個数をCxとして、C1≧C2≧C3…が成り立てば良い。順列の個数はC1。答えは-1だけど入力にnより大きい数がくることもあり得る。 n = input() P = map(int,raw_input().split()) N = max(P) C = [0]*(N+1) A = [0]*n for i in range(n): C[P[i]] +=…

Codeforces Beta Round #45 C. The Race

The Race1kmごとにガソリンスタンドがあり、ガソリン1リットルで1km進むと考えても答えは同じ。入力のi番目がsだったとすると、残っているガソリンはa*i-sリットル。そこで給油するので0

Codeforces Beta Round #45 B. Land Lot

http://www.codeforces.com/contest/48/problem/B:title=Land Lot] def read(): return map(int,raw_input().split()) n,m = read() G = [read() for i in range(n)] a,b = read() ans = n*m for i in range(n-a+1): for j in range(m-b+1): t = sum([sum(g[…

Codeforces Beta Round #45 A. Rock-paper-scissors

Rock-paper-scissorsじゃんけん。 def win(a,b,c): return ( a=="rock" and b==c=="scissors" or a=="paper" and b==c=="rock" or a=="scissors" and b==c=="paper" ) F,M,S = raw_input(),raw_input(),raw_input() if win(F,M,S): print "F" elif win(M,S,F…

Codeforces Beta Round #45

A + 00:25 B + 00:35 C + 01:52 D +1 00:49 結果 110位 1849 → 1787 Eが解けなくて悔しい。