package nowcoder;
import java.util.Scanner;
public class Main2 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int m = sc.nextInt(); System.out.println(Main2.getLess(n, k, m)); sc.close(); } private static int getLess(int n, int k, int m) { int t = n * k; int count = 0; while(t > 0) { t -= Math.min(n, m); count++; } return count; }
}
思路:用一个方格阵列,横轴为魔兽数,竖轴为技能数。我们的目标是用已有的导师数填充完整个方格。
(1)若导师数 < 魔兽数,优先照顾那些学过技能较少的魔兽。
(2)若导师数 > 魔兽数,那没办法了,一次最多只能教魔兽数=n个魔兽。
执行填充操作的次数就是所需最少次数。
说是AC了...我总有种不祥的预感hhh