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

SRM563 Div2 Hard(1000) SpellCardsEasy

SpellCardsEasy動的計画法。位置pからl枚のカードを使いr枚のカードを残す場合の最高ダメージを覚えてく。O(n5)だけど、for(x=0;x #include <vector> using namespace std; class SpellCardsEasy{public: int maxDamage( vector <int> level, vector <int> damage ) { int n = </int></int></vector>…

SRM563 Div2 Medium(550) CoinsGameEasy

CoinsGameEasy全探索。 #include <string> #include <vector> using namespace std; vector<string> B; int w, h; int BT( int d, int cx1, int cy1, int cx2, int cy2 ) { bool in1 = 0<=cx1 && cx1</string></vector></string>

SRM563 Div2 Easy(250) FoxAndHandleEasy

FoxAndHandleEasy #include <string> using namespace std; class FoxAndHandleEasy{public: string isPossible( string S, string T ) { for ( int i=0; i<=(int)S.size(); i++ ) if ( S.substr(0,i)+S+S.substr(i)==T ) return "Yes"; return "No"; }};</string>

SRM563 Div1 Medium(500) SpellCards

SpellCards動的計画法。位置pからl枚のカードを使いr枚のカードを残す場合の最高ダメージを覚えてく。O(n5)だけど、for(x=0;x #include <vector> using namespace std; class SpellCards{public: int maxDamage( vector <int> level, vector <int> damage ) { int n = (int)lev</int></int></vector>…