SRM602 (div2)


 TypoCoderDiv2   

没注意:their rating is 500 !!! 打脸。。


 PilingRectsDiv2

简单的暴力:

class PilingRectsDiv2 {
public:
	int getmax(vector <int>, vector <int>, int);
};

int PilingRectsDiv2::getmax(vector <int> X, vector <int> Y, int limit) {
	int ans = 0, i, j, k, Max;
	for(i=1; i<=200; ++i) 
	for(j=1; j<=200; ++j){
		if(i*j >= limit) {
			Max = 0;
			for(k=0; k<X.size(); ++k){
				if( (X[k]>=i&&Y[k]>=j) || (X[k]>=j&&Y[k]>=i) )
					Max++;
			}
			if(Max > ans ) ans = Max;
		}
	}
	if(ans == 0) return -1;
	else return ans;
}
还可以用记忆化搜索做(别人的代码):

int
solve (int idx, int l, int b) {
    if (idx == N) {
        if (l == LIM && b == LIM) return -1;
        if (l * b >= lim) return 0;
        if (l * b < lim) return -INF;
    }
    if (memo [idx][l][b] != -1) return memo [idx][l][b];
    int ret = 0;
    ret = 1 + max (solve (idx + 1, min (L [idx], l), min (B [idx], b)),
                   solve (idx + 1, min (B [idx], l), min (L [idx], b)));
    ret = max (ret, solve (idx + 1, l, b));
    return memo [idx][l][b] = ret;
}
 
class PilingRectsDiv2 {
    public:
    int
    getmax(vector<int> X, vector<int> Y, int limit) {
        L = X; B = Y;
        memset (memo, -1, sizeof (memo));
        LIM = 202;
        lim = limit;
        N = len (X);
        return solve (0, LIM, LIM);
    }
};

 BlackBoxDiv2

没看,不会做。

先留着,以后解决。

http://community.topcoder.com/stat?c=problem_solution&rd=15820&pm=12929&cr=23288241

http://community.topcoder.com/stat?c=problem_solution&rd=15820&pm=12929&cr=23282585

http://community.topcoder.com/stat?c=problem_solution&rd=15820&pm=12929&cr=23288971

http://community.topcoder.com/stat?c=problem_solution&rd=15820&pm=12929&cr=23137498

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值