Careercup - Microsoft面试题 - 5649647234187264
2014-05-10 22:17
原题:
A draw method is given, write a function to draw a chess board. The Draw method, draws a square and has parameters row position, column position and color.
题目:给定一个draw()方法,请画出一个国际象棋盘。函数参数有行、列和颜色。
解法:这个题是想考察什么?没想太明白,先写个出来吧。我完全不会国际象棋,所以查了下到底是“黑白...”还是“白黑...”。根据有信号发亮,没信号黑的常识,我姑且认为0是黑色吧。所以有了以下代码。
代码:
// http://www.careercup.com/question?id=5649647234187264
// i for row, j for column, color represented as integer id.
// 0 for white, 1 for black.
void draw(int i, int j, int color); void drawChessBoard() {
int i; /*
b w b w b w b w
w b w b w b w b
b w b w b w b w
w b w b w b w b
b w b w b w b w
w b w b w b w b
b w b w b w b w
w b w b w b w b
*/ for (i = ; i < ; ++i) {
draw(i >> , i & , i + & );
}
}
Careercup - Microsoft面试题 - 5649647234187264的更多相关文章
- Careercup - Microsoft面试题 - 6314866323226624
2014-05-11 05:29 题目链接 原题: Design remote controller for me. 题目:设计一个遥控器. 解法:遥控什么?什么遥控?传统的红外线信号吗?我只能随便说 ...
- Careercup - Microsoft面试题 - 6366101810184192
2014-05-10 22:30 题目链接 原题: Design database locks to allow r/w concurrency and data consistency. 题目:设计 ...
- Careercup - Microsoft面试题 - 24308662
2014-05-12 07:31 题目链接 原题: I have heard this question many times in microsoft interviews. Given two a ...
- Careercup - Microsoft面试题 - 5700293077499904
2014-05-12 00:02 题目链接 原题: For a given map (ie Bing map) given longitude/latitude/ how would you desi ...
- Careercup - Microsoft面试题 - 5204967652589568
2014-05-11 23:57 题目链接 原题: identical balls. one ball measurements ........ dead easy. 题目:9个看起来一样的球,其中 ...
- Careercup - Microsoft面试题 - 5175246478901248
2014-05-11 23:52 题目链接 原题: design an alarm clock for a deaf person. 题目:为聋人设计闹钟? 解法:聋人听不见,那么闪光.震动都可行.睡 ...
- Careercup - Microsoft面试题 - 5718181884723200
2014-05-11 05:55 题目链接 原题: difference between thread and process. 题目:请描述进程和线程的区别. 解法:操作系统理论题.标准答案在恐龙书 ...
- Careercup - Microsoft面试题 - 5173689888800768
2014-05-11 05:21 题目链接 原题: Complexity of a function: int func_fibonacci ( int n) { ) { return n; } el ...
- Careercup - Microsoft面试题 - 6282862240202752
2014-05-11 03:56 题目链接 原题: Given an integer array. Perform circular right shift by n. Give the best s ...
随机推荐
- ASP.NET数据绑定
数据绑定是ASP.NET提供的另一种访问数据库的方法.与ADO.NET数据库访问技术不同的是:数据绑定技术可以让程序员不关注数据库连接.数据库命令以及如何格式化这些数据以显示在页面上等环节,而是直接把 ...
- 使用OrderBy对List<Person>集合排序
string sortOrder = Request.QueryString["sortOrder"]; string sortField = Request.QueryStr ...
- 树莓派 B+ Yeelink实现图像监控
树莓派 B+ Yeelink实现图像监控 数值传感器请参考 : http://blog.csdn.net/xiabodan/article/details/39084877 1 安装摄像头 ...
- Linux文件和目录管理常用重要命令
一.目录与路径 1.相对路径与绝对路径 因为我们在Linux系统中,常常要涉及到目录的切换,所以我们必须要了解 "路径" 以及 "相对路径" 与 "绝 ...
- ASP.NET中Button控件的CommandName和CommandArgument属性用法
在Repeater中的使用: <asp:Repeater ID="rptActionList" runat="server" OnItemCommand= ...
- Ajax的get请求向服务器请求数据五步骤?
如下: ①创建ajax对象 ②建立http请求 ③发送http请求 ④设置ajax对象状态改变的回调函数 ⑤判断ajax状态是否等于4,做相应的业务逻辑
- php变量那些事:php引擎对变量声明、存储简要分析(ZVAL)
php中变量有三个基本的特性: 1.变量符号.也就是变量的名称.形象比喻,kv中的key.这个有php引擎的符号表(hash表)管理. 2.变量类型.一个php变量可以是boolean.integer ...
- 往Android SDCard中读写入数据
一.用Environment (写) 1.API获取sdcard的路径 File path=Environment.getExternalStorageDirectory(); path=new Fi ...
- 共享内存shared pool (6):追踪sql语句
构建实验数据 --使用NC50用户查询(会话1) SQL> conn NC50/NC50 Connected. SQL> create table emp as select * from ...
- 问题记录-Fragment导包不同导致无法自动转型
代码如下 public class MainActivity extends FragmentActivity { @Override public void onCreate(Bundle save ...