
求翻译一道编程题
求翻译一道编程题3、Yourbosshasaskedyoutoaddupasequenceofpositivenumberstodeterminehowmuchmoney...
求翻译一道编程题3、Your boss has asked you to add up a sequence of positive numbers to determine how much money your company made last year.
Unfortunately, your boss reads out numbers incorrectly from time to time.
Fortunately, your boss realizes when an incorrect number is read and says “zero”, meaning “ignore the current last number.”
Unfortunately, your boss can make repeated mistakes, and says “zero” for each mistake.
For example, your boss may say “One, three, five, four, zero, zero, seven, zero, zero, six”, which means the total is 7 .
Write an algorithm that reads the sequence of boss statements and computes the correct sum. 展开
Unfortunately, your boss reads out numbers incorrectly from time to time.
Fortunately, your boss realizes when an incorrect number is read and says “zero”, meaning “ignore the current last number.”
Unfortunately, your boss can make repeated mistakes, and says “zero” for each mistake.
For example, your boss may say “One, three, five, four, zero, zero, seven, zero, zero, six”, which means the total is 7 .
Write an algorithm that reads the sequence of boss statements and computes the correct sum. 展开
2个回答
展开全部
3、Your boss has asked you to add up a sequence of positive numbers to determine how much money your company made last year.
3,你的老板要求你加起来一个正数序列来确定你的公司去年多少钱。
Unfortunately, your boss reads out numbers incorrectly from time to time.
不幸的是,你的老板将读出数字不正确的时候。
Fortunately, your boss realizes when an incorrect number is read and says “zero”, meaning “ignore the current last number.”
幸运的是,你的老板意识到当一个错误的号码是阅读和说“零”,意思是“忽略目前最后的数字。”
Unfortunately, your boss can make repeated mistakes, and says “zero” for each mistake.
不幸的是,你的老板可以犯重复的错误,并表示“零”为每个错误。
For example, your boss may say “One, three, five, four, zero, zero, seven, zero, zero, six”, which means the total is 7 .
例如,你的老板可能会说“一,三,五,四,零,零,七,零,零,六,这意味着总是7。
Write an algorithm that reads the sequence of boss statements and computes the correct sum.
写一个算法读取老板语句的序列并计算正确的总和。
3,你的老板要求你加起来一个正数序列来确定你的公司去年多少钱。
Unfortunately, your boss reads out numbers incorrectly from time to time.
不幸的是,你的老板将读出数字不正确的时候。
Fortunately, your boss realizes when an incorrect number is read and says “zero”, meaning “ignore the current last number.”
幸运的是,你的老板意识到当一个错误的号码是阅读和说“零”,意思是“忽略目前最后的数字。”
Unfortunately, your boss can make repeated mistakes, and says “zero” for each mistake.
不幸的是,你的老板可以犯重复的错误,并表示“零”为每个错误。
For example, your boss may say “One, three, five, four, zero, zero, seven, zero, zero, six”, which means the total is 7 .
例如,你的老板可能会说“一,三,五,四,零,零,七,零,零,六,这意味着总是7。
Write an algorithm that reads the sequence of boss statements and computes the correct sum.
写一个算法读取老板语句的序列并计算正确的总和。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询