2012-10-05から1日間の記事一覧

続・PFIサマーインターン2011問題

今更ですが、これの続き。 前回は最悪がO(n2)だったので、最悪をO(n)にしました。 #include <assert.h> #include <algorithm> #include <string> char pfi2011(std::string& s) { assert(!s.empty()); typedef std::string::iterator iter_t; iter_t l = s.begin(), r = s.end(); iter_t c</string></algorithm></assert.h>…