问题...请阅读 [英] PROBLEM...please READ

查看:75
本文介绍了问题...请阅读的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//问题陈述

//

//你在一家销售机械位计数设备的公司工作。

这些设备

//当他们进行大量计算时会磨损。你将会看到

多少磨损已经被放在一个特定的15位二进制计数器上。一个单位的磨损

发生在

//柜台翻转的每一位。

//

//例如:

//如果计数器为7 = 000000000000111

//它增加到8 = 000000000001000

//

//然后翻转4位,这样就会出现4个磨损单位。如果一个柜台



//通过包含范围增加,如7 - > 12然后:

//从7开始= 000000000000111

//去8 = 000000000001000 7 - > 8 = 4个磨损单位

//去9 = 000000000001001 8 - > 9 = 1个磨损单位

//去10 = 000000000001010 9 - > 10 = 2个磨损单位

//去11 = 000000000001011 10 - > 11 = 1个磨损单位

//去12 = 000000000001100 11 - > 12 = 3个磨损单位

//这导致总共4 + 1 + 2 + 1 + 3 = 11个磨损单位。返回总计

的磨损,这是因为在开始和结束之间将计数器递增到


//定义

//

//类:MechanicalCounter

//方法:amountWear

//参数:int,int

//返回:int

//方法签名:int amountWear(int start,int finish)

//

/ /(确保你的方法是公开的)

//

//

//约束

// -start将小于终点。

// - 开始将介于0和32766之间。

// - 完成将介于1和32767之间。

//

//例子

// 0)

// 7

// 8

//返回:4

//如上图所示,当7变为8时会出现4个磨损单位。

//

// 1)

//

// 7

// 12

//返回:11

// p中的示例roblem声明。

//

// 2)

// 1

// 32767

//返回:65518

//Problem Statement
//
//You work for a company that sells mechanical bit counting devices.
These devices
//wear out when they do a lot of counting. You are going to see how
much wear has
//been put on one particular 15-bit binary counter. One unit of wear
occurs for
//every bit that is flipped in the counter.
//
//For example:
//If the counter was at 7 = 000000000000111
//And it was incremented to 8 = 000000000001000
//
//Then 4 bits are flipped so 4 units of wear would occur. If a counter
was
//incremented through an inclusive range like 7 -> 12 then :
//Starts at 7 = 000000000000111
//Goes to 8 = 000000000001000 7 -> 8 = 4 units of wear
//Goes to 9 = 000000000001001 8 -> 9 = 1 unit of wear
//Goes to 10 = 000000000001010 9 -> 10 = 2 units of wear
//Goes to 11 = 000000000001011 10 -> 11 = 1 unit of wear
//Goes to 12 = 000000000001100 11 -> 12 = 3 units of wear
//This causes a total of 4+1+2+1+3 = 11 units of wear. Return the total
wear caused by incrementing the counter through the inclusive range
between start and finish.
//Definition
//
//Class: MechanicalCounter
//Method: amountWear
//Parameters: int, int
//Returns: int
//Method signature: int amountWear(int start, int finish)
//
//(be sure your method is public)
//
//
//Constraints
//-start will be less than finish.
//-start will be between 0 and 32766 inclusive.
//-finish will be between 1 and 32767 inclusive.
//
//Examples
//0)
//7
//8
//Returns: 4
//As seen above, 4 units of wear occur when 7 becomes 8.
//
//1)
//
//7
//12
//Returns: 11
//The example in the problem statement.
//
//2)
//1
//32767
//Returns: 65518

推荐答案

" Gagan" <在******* @ gmail.com>写道:
"Gagan" <In*******@gmail.com> writes:
//问题陈述
//
//您为一家销售机械位计数设备的公司工作。
//Problem Statement
//
//You work for a company that sells mechanical bit counting devices.



[snip]


不,我不,所以我想我无法帮助你。


这看起来非常多就像一个家庭作业问题一样,你没有做出明显的努力来自己解决这个问题。


如果你真的希望我们做所有的工作您,请给我们您的

教练的电子邮件地址,以便我们直接提交解决方案。

如果没有,请告诉我们一些代码,我们可能会能够提供帮助。


-

Keith Thompson(The_Other_Keith) ks * **@mib.org < http://www.ghoti.net/~kst>

圣地亚哥超级计算机中心< *> < http://users.sdsc.edu/~kst>

我们必须做点什么。这是事情。因此,我们必须这样做。


[snip]

No, I don''t, so I guess I can''t help you.

This looks very much like a homework problem, and you''ve made no
visible effort to solve it yourself.

If you really want us to do all the work for you, please give us your
instructor''s e-mail address so we can submit the solution directly.
If not, show us some code, and we might be able to help.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.


在文章< 11 ********************* @ p10g2000cwp .googlegroups。 com>,

Gagan< In ******* @ gmail.com>写道:
In article <11*********************@p10g2000cwp.googlegroups. com>,
Gagan <In*******@gmail.com> wrote:
//类:MechanicalCounter
//方法:amountWear
//方法签名:int amountWear(int start,int finish)
//Class: MechanicalCounter
//Method: amountWear //Method signature: int amountWear(int start, int finish)




C中不存在方法。如果你有C ++问题,你需要在comp.lang.c ++中询问



但是看起来你没有C ++的问题:看起来好像你有一个家庭作业问题,而且看起来你是隐含的

的问题是,是否有人会为你做功课,并允许

你可以申请信用额度。


如果你有一个算法问题,那么其中一个编程

新闻组可能是合适的 - 但除非你在
$ b上概述你的想法,否则他们不太可能帮助你。 $ b主题,你给出了一些关于你不确定的部分的问题。

我会尽量给你一个提示:考虑一下; e xclusive或者

-

那时候我还很年轻,但我也很朦胧。

- Christopher Priest



Methods do not exist in C. If you have a C++ question, you need to
ask it in comp.lang.c++ .

But it doesn''t appear that you have a C++ question: it appears that
you have a homework problem and it appears that your implicit
question is whether someone will do your homework for you and allow
you to claim the credit.

If you have an -algorithm- question, then one of the programming
newsgroups might be appropriate -- but they are not likely to
help you unless you give an outline of your thinking on the
topic, and you give -specific- questions about the parts you
are unsure about.
I will go as far as to give you a hint: think about "exclusive or".
--
I was very young in those days, but I was also rather dim.
-- Christopher Priest


>>问题陈述
>>Problem Statement
您在一家销售机械钻头计数的公司工作设备。
这些设备
You work for a company that sells mechanical bit counting devices.
These devices




我想你刚刚复制并粘贴了你的作业问题。否

这个组中的身体将为您完成整个任务。如果你坐下来开始自己解决它会更好,如果你遇到任何困难,你可以将它粘贴在这里。


Vishal



I think you have just copied and pasted your assignment problem. No
body in this group will do the whole assignment for you. Its better if
you sit down and start solving it by yourself and then if you face any
difficulties you can paste it here.

Vishal


这篇关于问题...请阅读的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆