• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






dark_lake

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

2013年5月27日

projectEuler 17
摘要: 将1……n的数表示成英文,求表示成这些英文的字母的和If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are 3 + 3 + 5 + 4 + 4 = 19 letters used in total.If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?NOTE:Do not count sp 阅读全文
posted @ 2013-05-27 22:02 dark_lake 阅读(166) 评论(0) 推荐(0)
 
projectEuler 16
摘要: 求2的1000次方的各个位置上的数的和215= 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 21000?思想:普通算法肯定满足不了,只好自己实现大数算法,java的bigInteger应该可以做到这个吧,不过还是自己实现……构造一个334大的int数组,每一位存储最后计算结果的一个数值。只定义334个大小的数组的原因是因为在2的n次方最小最多3次就必须进一位,那么一位数最多可以保存2的三次方,所以取1000/3+1代码:private 阅读全文
posted @ 2013-05-27 21:56 dark_lake 阅读(144) 评论(0) 推荐(0)
 
projectEuler 15
摘要: 求格子的路径个数:Starting in the top left corner of a 22 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner.How many such routes are there through a 2020 grid?思想:这是做了这么久之后我比较喜欢的一个题,终于要思考推一下下了。给格子上的顶点依次从(0,0)标起,往右或者往下两个数字依次加1,将题目的示例就可以转化为(0,0)->( 阅读全文
posted @ 2013-05-27 21:47 dark_lake 阅读(342) 评论(1) 推荐(0)