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 ...
随机推荐
- 基于s5pv210嵌入式linux系统sqlite3数据库移植
基于s5pv210嵌入式linux系统sqlite3数据库移植 1.下载源码 http://www.sqlite.org/download.html 最新源码为3080100 2.解压 tar xvf ...
- mysql多实例安装脚本
#! /bin/bash # v.mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz # only install master mysql # time:2016-0 ...
- POJ C++程序设计 编程作业—类和对象 编程题#3
编程题 #3 来源: POJ (Coursera声明:在POJ上完成的习题将不会计入Coursera的最后成绩.) 注意: 总时间限制: 1000ms 内存限制: 65536kB 描述 下面程序的输出 ...
- jquery之val()和attr("value")
1.attr("value")=原来的默认值 ,而val()=用户改变的值.
- canvas 绘圆加边框
HTML5中canvas元素,绘制圆形需要使用路径,开始时要取得图形上下文,首先使用路径来勾勒图形的轮廓,然后设置颜色,进行绘制. arc(cx,cy,radius,start_angle,end_a ...
- centos6.7下网络设置
vi /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0"BOOTPROTO="static" # ...
- .ascx.g.cs文件不能生成 The name ‘InitializeControl’ does not exist in the current context - Visual Web part Sharepoint
InitializeControl doesn't exsit When using visual studio 2012 for developing SharePoint 2013 Visual ...
- TE.TYCO.AMP/JST 现货资源备份库存表日志记录-2015-04-13
行号 品牌 料号 品名规格 库存 1 molex 09-65-2028 Molex 5273-02A 600 2 tyco 103648-2 AMP 03 MTE RCPT HSG SR RIB .1 ...
- 转:javascript 中select的取值
javascript获取select的值全解 获取显示的汉字 document.getElementById("bigclass").options[window.document ...
- WPF 中的字号问题
用WPF搞打印机真是各种碰壁,尤其是对于我这个没有搞过打印机的人来说,更是遍布神坑T_T. 今天敲代码的时候发现字体的FontSize貌似跟单位也有关系啊,因为打印的时候效果感觉和预期竟然是有着差距的 ...