君はまるで砂漠に咲く、一輪の花。

僕はその花に引き寄せられる蝶。

Codeforces Beta Round #41

はい。
http://codeforces.com/contest/42

A. Guilty — to the kitchen!

greedy,implementation

ざっくりと大意

・Volodyaにとって非常に不運な日で罰でキッチンでボルシチ作り??
・材料を合わせる比率は必ず決まった比率でなければいけない?
・nが材料の種類、Vが今回調理できる限界量、a行が比率、b行が実際ある量?

方針のようなもの

・b[i]/a[i]を計算した最も小さな値とa行のsumを掛け算したものとVの小さい方を出力。

#!/usr/bin/env python
# -*- coding: UTF-8 -*-
import time
import sys, io
import re, math
#start = time.clock()
(n,v)=map(int, raw_input().split())
a=[float(x) for x in raw_input().split()]
b=[float(x) for x in raw_input().split()]
cal=[]
for i in range(n):
    cal.append(b[i]/a[i])
print min(float(v),(sum(a)*min(cal)))

2766983のdaidailanlanさんの回答

n, V = map(int, raw_input().split())
a = map(int, raw_input().split())
b = map(int, raw_input().split())
print min(min(y * 1. / x for x, y in zip(a, b)) * sum(a), V)

うーん。。zip使える、練習できる場面であることに気づくべきだったなぁ。。。