题意:给定钱,计算其能换成零钱的分类种数. 解题关键:完全背包计数. $dp[i][j]$表示前i个物品构成j元的种类数,然后优化一维. #include<bits/stdc++.h> using namespace std; typedef long long ll; ]={,,,,,,,,,,,,}; ]; ; int main(){ int n; scanf("%d",&n); dp[]=; ;i<;i++){ for(int j=a[i];j<=…
import scala.collection.mutable.ArrayBuffer import scala.util.control.Breaks object Exchange { def delete(arg:ArrayBuffer[Int]):ArrayBuffer[Int]={ val breakables = new Breaks breakables.breakable { for (i <- 0 until arg.length) { if (arg(i) == arg.ma…
51nod 1134 最长递增子序列 #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define rep(i,l,r) for (int i=l; i<=r; i++) typedef long long ll; using namespace std; ; int n, s[N]; int dp[N]; int main(){ freopen(&q…
1564. HOUSING Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description For the Youth Olympic Games in Singapore, the administration is considering to house each team in several units with at least 5 people per unit. A team can have from 5 to 1…