SRM340

 本来想比赛的~可是睡着了~5555555555555

 CssPropertyConverter

http://www.topcoder.com/stat?c=problem_statement&pm=7503&rd=10664

简单的字符串转化问题,没什么意思

ProblemsToSolve

http://www.topcoder.com/stat?c=problem_statement&pm=7504&rd=10664

一道枚举题目,不过据说可以O(n)的dp,没怎么看明白

CsCourses

http://www.topcoder.com/stat?c=problem_statement&pm=7505&rd=10664

dp的题,看了标程,感觉写的太好了,应该背下来

int dp(int curtheoretical,int curpractical,int curmonth) {
    if(curtheoretical>=skillBound&&curpractical>=skillBound) return 0;
    if(curmonth>=(int)theoreticalValue.size()) return INF;
    if(done[curtheoretical][curpractical][curmonth]) return cache[curtheoretical][curpractical][curmonth];
    else done[curtheoretical][curpractical][curmonth]=true;

    int ret=INF;
    for(int i=0;i<(int)theoreticalValue.size();++i)
        if(curtheoretical>=theoreticalValue[i]-1&&curpractical>=practicalValue[i]-1&&curmonth<expire[i]) {
            int cur=dp(max(curtheoretical,theoreticalValue[i]),max(curpractical,practicalValue[i]),curmonth+1)+1;
            if(cur<ret) {
                ret=cur;
                bestcourse[curtheoretical][curpractical][curmonth]=i;
            }
        }
    return cache[curtheoretical][curpractical][curmonth]=ret;
}

vector<int> construct() {
    vector<int> ret;
    int curtheoretical=0,curpractical=0,curmonth=0;
    while(curtheoretical<skillBound||curpractical<skillBound) {
        int course=bestcourse[curtheoretical][curpractical][curmonth];
        ret.push_back(course);
        curtheoretical=max(curtheoretical,theoreticalValue[course]);
        curpractical=max(curpractical,practicalValue[course]);
        ++curmonth;
    }
    return ret;
}

VegetableGarden

http://www.topcoder.com/stat?c=problem_statement&pm=7507&rd=10664

    要解决几个问题

        1:怎么判断走的路径不自交

              根据题中所说,所有自交的路径都可以用不自交的方法表示出来,所以这个问题不用考虑

        2.:怎么判断点是否被围在多边形里

        One way to do this is to draw a line from the point in an arbitrary direction, and test if the number of lines of the polygon it intersects is even (outside the polygon) or odd (inside the polygon).

         3:用状态压缩的方法表示每个关注的点上方的边数(1为奇,0为偶),并且预处理得到一个under[x][y]数组表示在(x,y)到(x,y+1)这条直线对所有关注的点来说是在上方还是在下方。

        4:bfs实现所有结点的遍历51*51*2^10,并且用一个数组记录最优值。

 
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值