2009-06-01から1ヶ月間の記事一覧

練習してます

C++

SRM 335 DIV2 250 回文を作れという問題。 1つだけテストを通らなかったので作り直した。しょうもない間違いでした。 #include <vector> #include <string> #include <iostream> using namespace std; class Palindromize{ public: string minAdds(string s) { string tmp, ans; int si</iostream></string></vector>…

数学英語

http://homepage2.nifty.com/PAF00305/math/writing.html

iddy

iddyに登録してみた。 使い方がまだよくわかんね。

練習中

C++

C++の練習がてらに簡単なTopCoderの問題を解いてみる。 SRM 255 DIV2 250 #include <iostream> #include <algorithm> #include <vector> #include <string> #include <sstream> using namespace std; class SequenceOfNumbers{ public: vector <string> rearrange(vector <string> sequence){ vector <int> numbers; vector <string> ans;</string></int></string></string></sstream></string></vector></algorithm></iostream>…

メモり

BoostをVisual C++で使いたいときはBoostPro(http://www.boostpro.com/)が便利。 bjamより速くて簡単でごわす。

とりあえずlibSVMを使ってみる

C++

libSVMをとりあえず使ってみる。SVMのタイプはONE CLASS。 こんな感じのデータを突っ込んでみた。イメージはイメージ。 #include "svm.h" #include <iostream> #include <list> using namespace std; struct point { double x, y; signed char value; }; const int current_v</list></iostream>…

ヘッダを読み飛ばし

id:Schimaさんの指摘とおりにbitmapのヘッダを読み飛ばしてみる。 そうすると想定通りの結果が得られた。といってもimgeDataに値を突っ込む前に54回ReadByte()させるだけだが。 こんな簡単なことに気づかないなんて呆けてました・・・。 id:Schimaさんありが…

BMPをネットからIplImageに読み込み

インターネット上のBMPファイルをIplImageに読み込んで表示させてみたい。 #pragma comment(lib,"cv.lib") #pragma comment(lib,"cxcore.lib") #pragma comment(lib,"highgui.lib") #include <cv.h> #include <highgui.h> #include <iostream> #using <System.dll> using namespace std; using names</system.dll></iostream></highgui.h></cv.h>…

コードの見方

TopCoderで他人様のコードを見る方法がわからなくて少し悩んだ。 Statics → Match Result → 見たいのを選ぶ → 見たい人を選ぶ → 下のほうにあるProblemを選ぶ こんな感じか。

解いてみる

SRM 440 DIV2 250 #include <cmath> #include <vector> using namespace std; class IncredibleMachineEasy { public: double gravitationalAcceleration(vector <int> height, int T); }; double IncredibleMachineEasy::gravitationalAcceleration(vector <int> height, int T) { do</int></int></vector></cmath>…

ネットワークカメラ

ネットワークカメラから画像を受信してIplImageにぶち込みたいなーと思い色々と調べてみた。 .NETクラスを使って組んでみるとネットワーク関係がすっきり記述できそうな予感。画像をストリームに入れてから、Stream.ReadByteメソッドで読み込んでいけばいい…

定時退社

http://sdc.sun.co.jp/java/event/lecture/JMAR001-05.pdf たまにJavaで定時退社だーってネタを見るんですけど、これが元ネタなのかな? Javaはほとんど知らないんですけど、研修でJavaやるみたいだし勉強したほうがいいかな。

パズル

プログラマのための論理パズルに載っている問題を解いてみる。 0.5%の確率で被害にあう装置を使うとき、最初の50人の中に少なくとも1人が被害にあう可能性を求める。 import random def puzzle18(percent): if random.randint(0, 1000) < percent: return 1 …

Pythonを5倍速くするらしいよ

http://arstechnica.com/open-source/news/2009/03/google-launches-project-to-boost-python-performance-by-5x.ars Google's Python engineers have launched a new project called Unladen Swallow that seeks to improve the performance of the Python …