摘要:
题目大意:输入一个m*n的矩阵,按每步走右上、右下、正右(三种选择)的方法,完成从第一列(任何行)走到最后一列。每步的消费是输入的矩阵元素值。注意,规定最后一行跟头一行是相邻的(即可以相互走到)。要求输出 字典序最小(若有多种)的路径,路径用每步所在行表示。行列都从1开始计算。输入 1<=m<=10, 1<=n<=100。输出结果不超出int32。注意:①A path starts anywhere in column 1. ② lexicographically smallest should be output. ③The first and last rows ( 阅读全文
摘要:
题目大意:用5种面额的硬币找钱(钱恰好),求方法数。要注意 1.Note that we count that there is one way of making change for zero cent. 2. Your program should be able to handle up to 7489 cents.题目类型: dp分析:记di 为要找i元钱的方法数,则di= { ∑(dj)| j=i-ck, k = 0~4 } ck 为硬币面额。①开始的时候单纯这样做,发现会有重复,如d11 = d10+d6+d1 , 而d10 和 d6里包含 1 5 11111、 5 11... 阅读全文