2013-04-24から1日間の記事一覧

0097:Sum of Integers II

0 から 100 の数字から異なる n 個の数を取り出して 合計が s となる組み合わせの数を求める問題。 動的計画法で解いた。 dp[取り出す個数][合計]:=組み合わせの数 #include <iostream> using namespace std; long long n,s,dp[11][1001]; int main(void){ dp[0][0] = </iostream>…

0263:Beat Panel

ビットDPで解いた。 dp[ビート音の数][ボタンの押し方]:=得点の最大値立っているビットの数を数える関数countは http://tak5219.seesaa.net/article/7042181.html を参考にした。 #include<iostream> #include<algorithm> #include<cstring> using namespace std; int a[30],b[30],dp[31][1<</cstring></algorithm></iostream>…