• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
neverlandly
博客园    首页    新随笔    联系   管理    订阅  订阅
2015年1月3日
Summary: gcd最大公约数、lcm最小公倍数算法
摘要: 欧几里德算法欧几里德算法又称辗转相除法,用于计算两个整数a,b的最大公约数。其计算原理依赖于下面的定理:定理:gcd(a,b) = gcd(b,a mod b)证明:a可以表示成a = kb + r,则r = a mod b假设d是a,b的一个公约数,则有d|a, d|b,而r = a - kb,因... 阅读全文
posted @ 2015-01-03 23:42 neverlandly 阅读(1425) 评论(0) 推荐(0)
Twitter OA prepare: Flipping a bit
摘要: You are given a binary array with N elements: d[0], d[1], ... d[N - 1]. You can perform AT MOST one move on the array: choose any two integers [L, R],... 阅读全文
posted @ 2015-01-03 04:52 neverlandly 阅读(688) 评论(0) 推荐(0)
Twitter OA prepare: Equilibrium index of an array
摘要: Equilibrium index of an array is an index such that the sum of elements at lower indexes is equal to the sum of elements at higher indexes. For exampl... 阅读全文
posted @ 2015-01-03 04:18 neverlandly 阅读(481) 评论(0) 推荐(0)
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3