![helps helps]()
本文介绍了另一个按位运算符拼图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 给定一个数字,我们需要将其除以3,而不使用*,/,%运算符。那么问题还提到itoa()函数可用!!Given a number, we need to divide it by 3, without using *, /, % operators. Well the question also mentions that itoa() function is available !!推荐答案 我没有尝试过itoa但它有点像跟随,希望它有所帮助:I have not tried with itoa but it is something like following, hope it helps: 展开 | 选择 | Wrap | 行号 这显然不是3333的情况。这可以除以3,但总和为12.除非你再次加12 ...然后你会得到3而你是正确的。但是,如果没有,你有一个反例。 现在,如果我记得正确的表格学校你可以检查一个数字是否可以除以3,如果基数10位数的总和返回一个可除以3的数字。 我没有这方面的证据,这只是他们在数学上给我们买的东西:) 希望这会有所帮助 欢呼, stefaanthis is obviously not the case take 3333. this is divisable by 3 but sums to 12. unless you sum 12 again ... then you would get 3 and you are correct. however if not there you have a counter example.Now if I remember correct form school you can check if a number is divisable by 3 if the sum of the base 10 digits returns a number divisable by 3.I don''t have proof for this, it''s just something they tought us at math :)hope this helpscheers,stefaan 这篇关于另一个按位运算符拼图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 14:15