2010-07-01から1ヶ月間の記事一覧

SRM476

250を解いて550を考えていたら、いつの間にか朝でした。 寝落ちは初体験。 250 Badgers barger数をKに固定したときに、hunger+greed*(K-1)が小さい順にbargerをK個選択すれば、bargerがK個の時に必要な最小食料が導出されます。この最小食料をtotalFoodと比…

SRM401 Div1 250

DP。カタラン数。境界線を超えてはいけない経路の数。 DPやカタラン数の良い演習問題。 countDiagrams class FIELDDiagrams { public: long long countDiagrams(int fieldOrder) { long long partition[45][45] = {0}; for(int i=1; i<=fieldOrder; i++){ pa…

SRM405 DIV1 250

日課消化。Unixの相対パスの記述問題。特に難しいところはありません。 というか問題文が長すぎていて読んでない…。テストケースだけで問題を類推しているので、間違いがあるかも。 makeRelative class RelativePath { public: string makeRelative(string p…

Codeforces #23

A,Bは直ぐに解法が出たけど、Cの解法が全然出なかった…。 どんな状態でも"Yes"になるのは間違いなくて、あとはappleやorangeを適当に大きい順に並べればいいのかな、とか考えてました。 A - You're Given a String... 愚直に部分文字列比較。 #include <algorithm> #inc</algorithm>…

SRM475

Div1にさっさと行くことが出来たので、良しとしましょう。 今回はうさぎ祭り。 RabbitVoting 計算するだけ。 #include <algorithm> #include <iostream> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define FOR(i,s,e) for (int i = int(</vector></string></sstream></set></numeric></map></iostream></algorithm>…

Member SRM 474

コードだけ。講義中だったのと、MediumのN+1にすべきところをNにしていて気づかなかったのが敗因。 PalindromesCount #include <algorithm> #include <iostream> #include <map> #include <numeric> #include <set> #include <sstream> #include <string> #include <vector> using namespace std; #define FOR(i,s,e) for (int </vector></string></sstream></set></numeric></map></iostream></algorithm>…