Project Euler 81

下記の5次の正方行列で、左上のセルから開始し右下のセルで終わるパスを探索する。 ただし下方向と右方向にのみ移動できるものとする。
通過したセルの和が最小となるパスは赤で示されたもので、その値は2427である。

131 673 234 103 18
201 96 342 965 150
630 803 746 422 111
537 699 497 121 956
805 732 524 37 331

今、31Kのテキストファイルmatrix.txtには80×80の行列が書かれている。
同様に左上のセルから開始し右下のセルで終わり、かつ右方向と下方向にのみ移動するときの最小のパスの和を求めよ。

#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <fstream>
using namespace std;

vector<string> split(const string& str, const string& delimiter) {
    // delimiter(2 文字以上も可) を空白に置換
    string item(str);    
    for(unsigned pos = item.find(delimiter); pos != string::npos; pos = item.find(delimiter, pos)) {
        item.replace(pos, delimiter.size(), " ");
    }
    // 分解
    stringstream buf(item);

    // 読み取り
    vector<string> result;
    while(buf >> item) {
        result.push_back(item);
    }

    return result;
}

const int SIZE = 80;


int main(){
	// ファイル読み込み
	ifstream ifs("dat081.txt");
	string tmp;
	vector<string> vstr;

	int v[SIZE+1][SIZE+1];

	for(int i=1 ; i<=SIZE ; i++){
		ifs >> tmp;
		vstr = split(tmp,",");

		for(int j=1 ; j<=SIZE ; j++){
			v[i][j] = atoi(vstr[j-1].c_str());
		}
	}

	int v2[SIZE+1][SIZE+1];


	for(int i=0 ; i<=SIZE ; i++){
		for(int j=0 ; j<=SIZE ; j++){
			v2[i][j] = 9999999;
		}
	}
	v2[0][0] = 0;
	v2[1][0] = 0;
	v2[0][1] = 0;

	for(int i=1 ; i<=SIZE ; i++){
		for(int j=1 ; j<=SIZE ; j++){
			v2[i][j] = min(v2[i-1][j],v2[i][j-1]) + v[i][j];
		}
	}

	cout << v2[SIZE][SIZE] << endl;

	int end;
	cin >> end;
}

ただのDP・・・