STL

もう一回ワンライナー。 今回はこちらのネタをお借りしまして http://d.hatena.ne.jp/nagoya313/20100619/1276954186 #include <fstream> #include <string> #include <list> #include <boost/regex.hpp> #include <boost/shared_ptr.hpp> #include <boost/make_shared.hpp> #include <pstade/oven/stream_lines.hpp> #include </pstade/oven/stream_lines.hpp></boost/make_shared.hpp></boost/shared_ptr.hpp></boost/regex.hpp></list></string></fstream>

さて、前回のエントリでは この部分 template<int RADIX> bool mirror_cmp(int figure, int num) { using namespace pstade::oven; PSTADE_OVEN_FOREACH(i, counting(0,figure/2)) { if( (num / power<RADIX>(figure-i-1)) % RADIX != (num / power<RADIX>(i)) % RADIX ) { return fal</radix></radix></int>…

さて、Mr.ExceptionのすずきさんがさっそうとProject EulerのProblem36を解いたらしいので、 僕も対抗心を燃やさせてください><。Problem36、 最初に例。585 = 1001001001(binary) このように10進数と2進数でともに回文になる数を1,000,000以下の整数の中…

問:int型の配列(コンパイル時に長さがわかるもの) b を std::vector v1, v2, v3にそれぞれコピーして表示せよ。 #include #include #include #include #include #include int main() { using namespace std; using namespace pstade::oven; vector v1, v2, …

std::lower_boundについてのメモ

std::lower_boundを使おうとしたところで疑問、 struct some_huge_structA { int value; int other1; int other2; //and many member };みたいな構造体のvalueでsortされていて、valueについての比較のもと、 lower_boundで取得したいとき。先ず、lower_boun…