2011-04-09から1日間の記事一覧

SRM320 div1 medium

メモ化再帰するだけ。 #include <sstream> #include <vector> using namespace std; class ContestSchedule { public: int n; double cache[55]; vector<int> start; vector<int> end; vector<double> winExp; double rec(int lastContest) { double &r=cache[lastContest]; if(!(r<0)) return r</double></int></int></vector></sstream>…

SRM466 div1 medium

class LotteryPyaterochka{ public: double chanceToWin(int N) { double n=N; return (10.0*(5*n-5)*(5*n-6)/2+5*(5*n-5)+1.0)*n*120/((5*n)*(5*n-1)*(5*n-2)*(5*n-3)*(5*n-4)); } };