2017年1月20日

D. Arpa's weak amphitheater and Mehrdad's valuable Hoses 分组背包模板题

摘要: http://codeforces.com/problemset/problem/742/D 并查集预处理出所有关系。 一开始的时候,我预处理所有关系后,然后选择全部的时候,另起了一个for,然后再判断。 这样是不对的。因为这样使得同一组里面可能选择了两次。 3 0 2 1 2 3 1 1 3 #i 阅读全文

posted @ 2017-01-20 20:18 stupid_one 阅读(141) 评论(0) 推荐(0) 编辑

1043 幸运号码 数位DP

摘要: http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1043 设dp[i][j]表示前i位数中,i位数的和为j时的所有情况。 转移的时候和普通的数位dp是一样转移的,但是如果你压缩了空间的话,就是用滚动数组的话,记录情况数就要多 阅读全文

posted @ 2017-01-20 19:07 stupid_one 阅读(195) 评论(0) 推荐(0) 编辑

C. Unfair Poll 数学题,

摘要: http://codeforces.com/contest/758/problem/C 需要一个能够找到任意一个位置的步数的方法,就能解决三个问题。 预处理出one(row, col)表示第一次经过这个点,需要的步数。 sec(row, col),thr(row, col)分别是第二、三步。 那么, 阅读全文

posted @ 2017-01-20 02:41 stupid_one 阅读(180) 评论(0) 推荐(0) 编辑

导航