Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:思路~

Posted by zhengzhenzhe220 at 2010-07-21 21:05:01 on Problem 2142
In Reply To:思路~ Posted by:5l2 at 2008-07-20 11:12:37
> 大概意思 给定 a b k找到满足ax+by=k 的x,y 令|x|+|y|最小(等时令a|x|+b|y|最小)不妨a 〉b
> 
> 先用扩展欧几里得算法求出 一组解 x0,y0
> 
> 通解可以表示为x=x0+b/d *t  y=y0-a/d *t
> 
> |x|+|y|=|x0+b/d *t |+|y0-a/d *t| 简单分析一下可知这个关于t的函数的最小值应该在t零点附近(因为要求t为整数)取到,再进一步考虑知道在   y0*d/a 附近的两整点里取。故直接验证这两点即可。
> 
> http://hi.baidu.com/5l2%5F/blog/item/a0381951b5738a1e367abef0.html
> 

还是不怎么理解t 的取值在y0*d/a 附近的两整点里取,为什么不在x0*d/b附近?

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator