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

2260 Error Correction

PKU

http://poj.org/problem?id=2260 概要 与えられた行列の各列各行の1の数が偶数であるか判定する。 偶数でない場合、ある一箇所を修正することで条件を満たすようにできるか調べる問題。 ソース #include<cstdio> #include<cstring> using namespace std; int main() { int n,a</cstring></cstdio>…

2263 Heavy Cargo

PKU

http://poj.org/problem?id=2263 概要 出発点から目的地までのパスの中で、パスの最小容量の辺の容量が最大になるようなパスを見つける問題。 ただ少し入力が面倒。 ソース #include<iostream> #include<cstring> #include<string> #include<map> using namespace std; #define REP(i,a,b) fo</map></string></cstring></iostream>…

これから

PKUやAOJで解いた問題やTopCoderやcodeforcesへの参加の記録をつけていこうと思います。

2258 The Settlers of Catan

PKU

http://poj.org/problem?id=2258 概要 グラフが与えられるので最も長いパスの長さを答える。 ソース #include<cstdio> #include<vector> #include<cstring> using namespace std; #define REP(i,a,b) for(i=a; i<b; ++i) #define rep(i,n) REP(i,0,n) int maxdepth; bool used[25][25]; void dfs(int depth,int p,vector<vector<int> > &g) { maxdepth = m…</b;></cstring></vector></cstdio>