10月28,K神开讲数据科学:AB Test/实验设计


一亩三分地论坛

 找回密码
 Sign Up 注册获取更多干货
天天打游戏、照样领工资、还办H1B
这份工作你要不要?
把贵司招聘信息放这里
查看: 5067|回复: 12
收起左侧

vmturbo 机经

[复制链接] |试试Instant~ |关注本帖
ice9123 发表于 2015-4-14 03:13:18 | 显示全部楼层 |阅读模式

2015(4-6月) 码农类 本科 全职@vmturbo - 网上海投 - 在线笔试 |Otherfresh grad应届毕业生

注册一亩三分地论坛,查看更多干货!

您需要 登录 才可以下载或查看,没有帐号?Sign Up 注册获取更多干货

x
1.You're asked to write a controller for a sorting machine for Christmas decorations.  . more info on 1point3acres.com
Decorations arrive at the scanner, and the percentages of red and green are reported.  . 1point 3acres 璁哄潧
Your must write a program that sorts the decorations into one of three bins:

Red, if the decoration is more than 35% red
Green, if the decoration is more than 30% green. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
Reject, if the decoration is both more than 35% red and 30% green - these are just too "loud". . 1point3acres.com/bbs
. 鍥磋鎴戜滑@1point 3 acres
The interfaces you have are the following:. 1point 3acres 璁哄潧

interface ScannerAndSorter {.1point3acres缃
        // Read and scan another item; return false when there are no more
        // items.
        bool nextItem();

        // Percentage (0-100) of the current item that's red.
        double redPercentage();

        // Percentage (0-100) of the current item that's green.. From 1point 3acres bbs
        double greenPercentage();. From 1point 3acres bbs

        // Send the current item to the Red bin
        void sendToRed();

        // Send the current item to the Green bin
        void sendToGreen();

        // Send the current item to the Reject bin. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
        void reject();
}

class DecorationSorter {
        ScannerAndSorter sorter;

        public DecorationSorter(ScannerAndSorter sorter) {
                this.sorter = sorter;
        }

        // Sort the decorations that 'sorter' reads.
        void sort() {. from: 1point3acres.com/bbs
                ... fill this in .... 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
        }
}


Implement the sort() function.
. 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
2.A maze is a group of linked Places.  Each Place has a North, South, East, and West Place adjacent to it.  There are two special pre-defined Place's:  
Place Wall represents a wall - the mouse can't go there.  Place Cheese is ... cheese!   The connections between Places are symmetrical - if you start
from any Place and go North and then South, you return to where you were.  To simplify things, the maze has no closed loops - that is, if you start in
any Place and follow any path, you eventually either hit a wall or find cheese - you never come back to the Place you started unless you actually
retrace your steps.

A mouse starts off in some Place and searches around for Cheese.  When it finds Cheese, it returns a set of directions - a string of the letters NSEW
that lead from where it started to the Cheese. The following framework defines the classes and functions.  Some other code
not included here generates a maze by creating a bunch of Place's and linking them.  It then calls mouse(), passing some starting Place from the maze:

interface Place {. 1point3acres.com/bbs

        // Return the adjacent Place in the given direction
        public Place goNorth();
        public Place goSouth();
        public Place goEast();. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
        public Place goWest();

        // Returns true only for the special "Wall" place-google 1point3acres
        public bool isWall();
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
        // Returns true only for the special "Cheese" place
        public bool isCheese();
};

class Mouse {
  public Mouse() {}.鐣欏璁哄潧-涓浜-涓夊垎鍦
. Waral 鍗氬鏈夋洿澶氭枃绔,
  // Return a string of the letters NSEW which, if used to traverse the. more info on 1point3acres.com
  // the maze from startingPoint, will reach a Place where isCheese() is
  // true.  Return null if you can't find such a path.
  public String findCheese(Place startingPoint) {
        ... fill this in .... 涓浜-涓夊垎-鍦帮紝鐙鍙戝竷
  }
}
. 鐗涗汉浜戦泦,涓浜╀笁鍒嗗湴
Implement findCheese().  You can add any fields or helper methods you need to Mouse.


Extra credit:  Eliminate the "no closed loops" restriction.  That is, change
your code so that it works correctly even if there might be a path like SSNEEW that leads the mouse back to the Place it started from.

评分

2

查看全部评分

woshiee123 发表于 2015-4-18 23:11:48 | 显示全部楼层
问下这个题如果第一个item 即《35red 也小于30 green 如何操作 ?
回复 支持 反对

使用道具 举报

 楼主| ice9123 发表于 2015-4-19 01:26:49 | 显示全部楼层
woshiee123 发表于 2015-4-18 23:11. 鍥磋鎴戜滑@1point 3 acres
问下这个题如果第一个item 即《35red 也小于30 green 如何操作 ?

什么都不做
回复 支持 反对

使用道具 举报

woshiee123 发表于 2015-4-19 02:09:21 | 显示全部楼层

那item的class 也没给么 ?item就是item.color 么? 需要一个变量sum么?还是不用自己算 直接有百分比
回复 支持 反对

使用道具 举报

 楼主| ice9123 发表于 2015-4-19 21:28:45 | 显示全部楼层
woshiee123 发表于 2015-4-19 02:09
那item的class 也没给么 ?item就是item.color 么? 需要一个变量sum么?还是不用自己算 直接有百分比

interface 里的方法都可以直接用,没有满足的条件就 nextItem。直接用给的方法,不用考虑具体是怎么实现的
回复 支持 反对

使用道具 举报

woshiee123 发表于 2015-4-19 22:07:56 | 显示全部楼层
ice9123 发表于 2015-4-19 21:28
interface 里的方法都可以直接用,没有满足的条件就 nextItem。直接用给的方法,不用考虑具体是怎么实现 ...
. 鍥磋鎴戜滑@1point 3 acres
可以用c++么 还是必须用java
回复 支持 反对

使用道具 举报

woshiee123 发表于 2015-4-20 23:05:14 | 显示全部楼层
woshiee123 发表于 2015-4-19 22:07
可以用c++么 还是必须用java

这个OA是要编译通过的么
回复 支持 反对

使用道具 举报

 楼主| ice9123 发表于 2015-4-21 21:37:51 | 显示全部楼层
woshiee123 发表于 2015-4-20 23:05
. visit 1point3acres.com for more.这个OA是要编译通过的么
. from: 1point3acres.com/bbs
不需要,就是一个写字板
回复 支持 反对

使用道具 举报

ffcc 发表于 2015-4-28 08:07:44 | 显示全部楼层
楼主有消息了么?
回复 支持 反对

使用道具 举报

 楼主| ice9123 发表于 2015-5-13 02:13:20 | 显示全部楼层
ffcc 发表于 2015-4-28 08:07
楼主有消息了么?

没有,一个多月了。估计是跪了
回复 支持 反对

使用道具 举报

hit_piggy 发表于 2015-5-14 03:54:54 | 显示全部楼层
请问LZ是怎么定位每一个place的?加一个field id在Place里面?谢了~
回复 支持 反对

使用道具 举报

he2004365 发表于 2015-11-17 05:08:25 | 显示全部楼层
楼主第二题怎么写的?BFS么?怎么记录东南西北的路径?如果用BFS的话
回复 支持 反对

使用道具 举报

漂洋过海 发表于 2016-2-20 23:08:45 | 显示全部楼层
he2004365 发表于 2015-11-16 16:08. From 1point 3acres bbs
楼主第二题怎么写的?BFS么?怎么记录东南西北的路径?如果用BFS的话
. 1point3acres.com/bbs
哥们 你想明白BFS 怎么记录路径了么
回复 支持 反对

使用道具 举报

本版积分规则

关闭

一亩三分地推荐上一条 /5 下一条

手机版|小黑屋|一亩三分地论坛声明

custom counter

GMT+8, 2017-10-18 17:15

Powered by Discuz! X3

© 2001-2013 Comsenz Inc. Design By HUXTeam

快速回复 返回顶部 返回列表