2011-03-30から1日間の記事一覧

SRM501 Div2 Easy(250) FoxProgression

FoxProgression #include <vector> using namespace std; class FoxProgression{public: int theCount( vector <int> seq ) { int n=(int)seq.size(); if ( n==1 ) return -1; int a1, a2; bool f1, f2; // 等差数列 int d = seq[1] - seq[0]; a1 = seq[n-1] + d; f1 = tr</int></vector>…

SRM501 Div1 Medium(500), Div2 Hard(1000) FoxAverageSequence

FoxAverageSequence動的計画法。数列の合計・直前のA[i]の値・A[i-1]≦A[i]が成り立つか、のそれぞれに対してbeautifulな数列の個数を覚えておく。A[i-1]の値は必要ない。 #include <vector> using namespace std; class FoxAverageSequence{public: int theCount( ve</vector>…

SRM501 Div1 Easy(250), Div2 Medium(500) FoxPlayingGame

FoxPlayingGame動的計画法。負値を掛けてスコアを最大にするためには最小値が必要となるので、move Aをa回とmove Bをb回行った時のスコアの最大値と最小値を覚えておく。 #include <vector> #include <cfloat> using namespace std; class FoxPlayingGame{public: double the</cfloat></vector>…

SRM501

Easy (250) 216.08 Medium (500) 0 Hard (1000) 0 Challenge 0 結果 1991 → 1946500を解きたかった(´・ω・`)