2013-11-01から1ヶ月間の記事一覧

1269:Sum of Different Primes

問題文 http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1269 動的計画法。 dp[使った素数の数][使った素数の最大のid][作りたい数]:=場合の数 #include<iostream> #include<vector> #include<algorithm> #define all(c) (c).begin(),(c).end() using namespace std; vector<int>w; </int></algorithm></vector></iostream>…

3999:The longest constant gene

文字列がいくつか与えられるので全ての文字列に現れる部分文字列の中で最長のものの長さを求めよ。 suffix arrayを使えば良い。共通部分文字列は蟻本に詳しく書いてる。嘘解法だった。隣同士の最長共通部分文字列しか計算してないのに通っていた。 #define I…