题意:给定钱,计算其能换成零钱的分类种数. 解题关键:完全背包计数. $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…
1.标题:换零钞x星球的钞票的面额只有:100元,5元,2元,1元,共4种.小明去x星旅游,他手里只有2张100元的x星币,太不方便,恰好路过x星银行就去换零钱.小明有点强迫症,他坚持要求200元换出的零钞中2元的张数刚好是1元的张数的10倍,剩下的当然都是5元面额的.银行的工作人员有点为难,你能帮助算出:在满足小明要求的前提下,最少要换给他多少张钞票吗?(5元,2元,1元面额的必须都有,不能是0) #include<stdio.h> int main() { int i,j; ;i<;…