In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy extensions for his field, each extension enlarges one of the field sizes in a particular number of times. Formally, there are n…
D. Field expansion time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In one of the games Arkady is fond of the game process happens on a rectangular field. In the game process Arkady can buy…
题目链接:http://codeforces.com/contest/799/problem/D 题意:给出h*w的矩阵,要求经过操作使得h*w的矩阵能够放下a*b的矩阵,操作为:将长或者宽*z[i] 有n个z[i]而且每个z[i]只能用一次. 题解:首先我们知道最少要扩大几倍, x = a / h + (a % h ? 1 : 0); y = b / w + (b % w ? 1 : 0); 当然要先排一下序从大到小,然后再是for一遍 pp *= z[i]; 如果pp>=x*y就是可行. 然…