由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
JobHunting版 - 急问!编程实现数学运算相关面试题
相关主题
再来道题请问面试时间冲突了怎么办?
stable rearrange an integer array with + and -请教一道Leetcode 题
discuss an array rearrange questionM家onsite回来了,晚上上面经
Google经典题目一问问一个题目,面试时我没有搞出来
赛马题伪O(1) space的O(n)时间重新排列a1a2a3...b1b2b3...算法
问个anagram的题目啊一道G面经
问个amazon面试题菜鸟追leetcode之一[text justification]
it's so difficult to handle indian interviewers保险公司叫我去面试怎么办?
相关话题的讨论汇总
话题: bob话题: alice话题: 42话题: cards话题: operations
进入JobHunting版参与讨论
1 (共1页)
S*******C
发帖数: 822
1
Alice has invented a new card game to play with Bob. Alice made a deck of
cards with random values between 1 and 52. Bob picks 5 cards. Then, he has
to rearrange the cards so that by utilizing the operations plus, minus, or
times, the value of the cards reach Alice's favorite number, 42. More
precisely, find operations such that ((((val1 op1 val2) op2 val3) op3 val4)
op4 val5) = 42.
Help Bob by writing a program to determine whether it is possible to reach
42 given 5 card values.
For example, Bob picks 5 cards out of the deck containing 60, 1, 3, 5, and
20. Bob rearranges the cards and supplies four operations, so that 5 * 20 -
60 + 3 - 1 = 42.
Input:
The input consists of five integers on a line, separated by spaces. Each
integer V is 0 <= V <= 52.
Output:
Print a line containing "YES" if it is possible to reach the value 42
according to the rules of the game, or "NO" otherwise.
S*******C
发帖数: 822
2
用 Reverse_Polish_Notation实现可以简化答案
求大神提供更多思路!
n******n
发帖数: 12088
3
这不就是24点的变种。

【在 S*******C 的大作中提到】
: 用 Reverse_Polish_Notation实现可以简化答案
: 求大神提供更多思路!

S*******C
发帖数: 822
4
终于有大神出现,我没做过24点,能提供更多信息吗?
马上要面试了,感激不尽

【在 n******n 的大作中提到】
: 这不就是24点的变种。
S*******C
发帖数: 822
5
找到了,本版终有大神

【在 n******n 的大作中提到】
: 这不就是24点的变种。
1 (共1页)
进入JobHunting版参与讨论
相关主题
保险公司叫我去面试怎么办?赛马题
CCup题目2.1是不是有更简单的O(n)的解问个anagram的题目啊
MS a0, a1, ..., b0, b1... 问题问个amazon面试题
讨论一道G的题find longest substring which contains just two unique characters.it's so difficult to handle indian interviewers
再来道题请问面试时间冲突了怎么办?
stable rearrange an integer array with + and -请教一道Leetcode 题
discuss an array rearrange questionM家onsite回来了,晚上上面经
Google经典题目一问问一个题目,面试时我没有搞出来
相关话题的讨论汇总
话题: bob话题: alice话题: 42话题: cards话题: operations