查看: 2511| 回复: 11
跳转到指定楼层
上一主题 下一主题
收起左侧

[CareerCup] [第二轮] 3/25-3/31 CareerCup 5.8

全局:

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

您需要 登录 才可以下载或查看附件。没有帐号?注册账号

x
本帖最后由 johnwan 于 2013-4-2 09:55 编辑

A monochrome screen is stored as a single array of bytes, allowing eight consecutive pixels to be stored in one byte. The screen has width w, where w is divisible "by 8 (that is, no byte will be split across rows). The height of the screen, of course," can be derived from the length of the array and the width. Implement a function drawHorizontalLine(byte[] screen, int width, int x1, int x2, int y) which draws a horizontal line from (x1,y) to (x2,y).

感谢SunnyDay1022纠正~

发帖规范:
http://www.1point3acres.com/bbs/thread-48094-1-1.html
http://www.1point3acres.com/bbs/thread-32423-1-1.html

上一篇:[第二轮] 3/25-3/31 CareerCup 5.7
下一篇:[第二轮] 3/25-3/31 CareerCup 6.1
🔗
willians512 2013-3-29 03:03:51 | 只看该作者
全局:
The screen has width w, where w is divisible can be derived from the length of the array and the width. 这句话什么意思呢? 咋感觉不通呢中间
回复

使用道具 举报

🔗
SunnyDay1022 2013-3-29 03:16:27 | 只看该作者
全局:
本帖最后由 SunnyDay1022 于 2013-3-30 01:54 编辑

题目中少了一句话
A monochrome screen is stored as a single array of bytes, allowing eight consecutive pixels to be stored in one byte. The screen has width w, where w is divisible "by 8 (that is, no byte will be split across rows). The height of the screen, of course," can be derived from the length of the array and the width. Implement a function drawHorizontalLine(byte[] screen, int width, int x1, int x2, int y) which draws a horizontal line from (x1,y) to (x2,y).
https://github.com/swang1022/career_cup/blob/master/career_cup_5.8/drawHorizontalLine.cpp


回复

使用道具 举报

全局:
https://github.com/1094401996/Ca ... edot8/DrawLine.java

*  method: 自己题目理解错误。。。看答案的, 自己智力已经无解了。。。
回复

使用道具 举报

🔗
 楼主| johnwan 2013-4-2 09:47:35 | 只看该作者
全局:
SunnyDay1022 发表于 2013-3-29 03:16
题目中少了一句话
A monochrome screen is stored as a single array of bytes, allowing eight consecuti ...

不好意思少打了。。
回复

使用道具 举报

🔗
天道酬勤 2013-4-25 13:22:23 | 只看该作者
全局:
规格严格理性帝 发表于 2013-4-2 08:02
https://github.com/1094401996/CareerCup/blob/master/Chapter05/src/fivedot8/DrawLine.java

*  meth ...

Hi, 题目什么意思呢?
回复

使用道具 举报

🔗
gnijuohz 2013-4-27 12:34:01 | 只看该作者
全局:
astkaasa 发表于 2013-4-16 10:33
https://gist.github.com/astkaasa/5392911

这个代码有点问题。
1. 应该是y*width/8而不是y*width
2. 两点在同一byte的时候单纯地左移右移是有问题的。应该是需要分是否在同一byte讨论的。
回复

使用道具 举报

🔗
gnijuohz 2013-4-29 21:58:50 | 只看该作者
全局:
astkaasa 发表于 2013-4-29 21:47
多谢指正,已修改

不谢不谢~共同进步~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号
隐私提醒:
  • ☑ 禁止发布广告,拉群,贴个人联系方式:找人请去🔗同学同事飞友,拉群请去🔗拉群结伴,广告请去🔗跳蚤市场,和 🔗租房广告|找室友
  • ☑ 论坛内容在发帖 30 分钟内可以编辑,过后则不能删帖。为防止被骚扰甚至人肉,不要公开留微信等联系方式,如有需求请以论坛私信方式发送。
  • ☑ 干货版块可免费使用 🔗超级匿名:面经(美国面经、中国面经、数科面经、PM面经),抖包袱(美国、中国)和录取汇报、定位选校版
  • ☑ 查阅全站 🔗各种匿名方法

本版积分规则

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