2013年11月16日

hdu 3709 Balanced Number

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3709数位dp,练模板好题。。题目要求求出[x, y] 范围内的平衡数,平衡数定义为:以数中某个位为轴心,两边的数的偏移量为矩,数位权重,使得整个数平衡。当然,首先可以简化一下条件~,设Kp为以p为支点的平衡度;则 Kp = sum(di*(i-p)); 故△Kp = K(p+1) - Kp = -sum(di);记 ps = K0 (以0为支点的平衡度), s =sum(di);所以条件存在Kp == 0等价为 s|ps. 1 #include 2 #include 3 #include 4 #in... 阅读全文

posted @ 2013-11-16 15:36 KimKyeYu 阅读(156) 评论(0) 推荐(0) 编辑

导航