代码改变世界

258_Add Digits

2015-11-26 14:08 by FTD_W, 123 阅读, 0 推荐, 收藏, 编辑
摘要:Given a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is like:3 + ... 阅读全文

292_Nim Game

2015-11-26 13:56 by FTD_W, 135 阅读, 0 推荐, 收藏, 编辑
摘要:You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 ston... 阅读全文

关于抑或

2015-11-26 13:19 by FTD_W, 176 阅读, 0 推荐, 收藏, 编辑
摘要:1. 使用抑或可以交换两个整数的值,不用借助第三个数字 a = a ^ b; b = b ^ a; a = a ^ b; 2.抑或可交换 a ^ b = b ^ a; 3.两个相同的整数,抑或运算后为0 ------------ 这一点可以经常利用 阅读全文