由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 算法作业求教
相关主题
一道面试算法题想成为嵌入式程序员应知道的0x10个基本问题 zz
请教一道算法题[合集] 想成为嵌入式程序员应知道的0x10个基本问题 zz
问一道面试题目google 首轮面世汇报
Bitonic search的问题Google电话面试题目
请教一道算法题[合集] Google电话面试题目
Another DP Problem: Balanced Partition职业杯另外一道
问一个min stack的问一道题
Walmart Lab onsite求指导再来一道简单的bit运算题
相关话题的讨论汇总
话题: xn话题: x1话题: solution话题: c1话题: cn
进入JobHunting版参与讨论
1 (共1页)
g*********e
发帖数: 14401
1
you are given positive INTEGERS x1,x2,...xn and K. A valid solution is
comprised of INTEGER coefficients c1,c2,...cn>=0 and c>=1, so that
c*K=c1*x1+...+cn*xn.
Pls find a solution that minimizes c.
请教咋做
b******n
发帖数: 4509
2
c = min(lcm(K, x_i))/K
lcm = least common multiple, i = 1...n

【在 g*********e 的大作中提到】
: you are given positive INTEGERS x1,x2,...xn and K. A valid solution is
: comprised of INTEGER coefficients c1,c2,...cn>=0 and c>=1, so that
: c*K=c1*x1+...+cn*xn.
: Pls find a solution that minimizes c.
: 请教咋做

g*********e
发帖数: 14401
3

but the coeeficients ci could be 0 here...

【在 b******n 的大作中提到】
: c = min(lcm(K, x_i))/K
: lcm = least common multiple, i = 1...n

b******n
发帖数: 4509
4
that's why there is min()

【在 g*********e 的大作中提到】
:
: but the coeeficients ci could be 0 here...

j*******r
发帖数: 20
5
反例 x1=6 x2=9 K=15

【在 b******n 的大作中提到】
: c = min(lcm(K, x_i))/K
: lcm = least common multiple, i = 1...n

g*********e
发帖数: 14401
6
i'm thinking of
c*K=sigma((ci+1)*xi)-sigma(xi)
so that we can apply the LCM thing, but couldn't figure out how to deal with
sigma(xi)
r****o
发帖数: 1950
7
I am thinking about using solution for coin problem.
x1, x2, ...xn are coins with different value, and each coin has unlimited
amount.
try
c*K=c1*x1+...+cn*xn. c increases from 1, 2, ...
until we find a solution.

【在 g*********e 的大作中提到】
: you are given positive INTEGERS x1,x2,...xn and K. A valid solution is
: comprised of INTEGER coefficients c1,c2,...cn>=0 and c>=1, so that
: c*K=c1*x1+...+cn*xn.
: Pls find a solution that minimizes c.
: 请教咋做

1 (共1页)
进入JobHunting版参与讨论
相关主题
再来一道简单的bit运算题请教一道算法题
Search in a sorted, rotated listAnother DP Problem: Balanced Partition
一道program challenge的题问一个min stack的
两个Amazon面试题Walmart Lab onsite求指导
一道面试算法题想成为嵌入式程序员应知道的0x10个基本问题 zz
请教一道算法题[合集] 想成为嵌入式程序员应知道的0x10个基本问题 zz
问一道面试题目google 首轮面世汇报
Bitonic search的问题Google电话面试题目
相关话题的讨论汇总
话题: xn话题: x1话题: solution话题: c1话题: cn