最直接的想法就是暴力搞搞,直接枚举,暴力分解因子。再好一点,就打个素数表来分解因子。假设num=p1^a1p2^a2...pn^an,则所有因子个数为(a1+1)(a2+1)...(an+1)。
再好一点呢,还是要利用积性函数。假设因子个数函数为f(x),因为num=n(n+1)/2,所以num2=n(n+1),因为n和n+1为相邻的正整数,所以互质,所以f(2num)=f(n)f(n+1),
则f(num)=f(n)
f((n+1)/2)(n+1为偶数)或者f(num)=f(n/2)*f(n+1)(n为偶数)。
人懒,写了个暴力的,140ms

Project Euler Problem 12-Highly divisible triangular number的更多相关文章

  1. project euler 12 Highly divisible triangular number

    Highly divisible triangular number Problem 12 The sequence of triangle numbers is generated by addin ...

  2. Highly divisible triangular number

    我的那个暴力求解,太耗时间了. 用了网上产的什么因式分解,质因数之类的.确实快!还是数学基础不行,只能知道大约. The sequence of triangle numbers is generat ...

  3. projecteuler---->problem=12----Highly divisible triangular number

    title: The sequence of triangle numbers is generated by adding the natural numbers. So the 7th trian ...

  4. Project Euler Problem 10

    Summation of primes Problem 10 The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of ...

  5. Project Euler problem 68

    题意须要注意的一点就是, 序列是从外层最小的那个位置顺时针转一圈得来的.而且要求10在内圈 所以,这题暴力的话,假定最上面那个点一定是第一个点,算下和更新下即可. #include <iostr ...

  6. Project Euler Problem (1~10)

    1.If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. Th ...

  7. Project Euler Problem 8-Largest product in a series

    直接暴力 写完才想到,代码写矬了,扫一遍就出结果了,哪还用我写的这么麻烦 ss = '''73167176531330624919225119674426574742355349194934 9698 ...

  8. Project Euler problem 62

    题目的大意很简单 做法的话. 我们就枚举1~10000的数的立方, 然后把这个立方中的有序重新排列,生成一个字符串s, 然后对于那些符合题目要求的肯定是生成同一个字符串的. 然后就可以用map来搞了 ...

  9. Project Euler problem 63

    这题略水啊 首先观察一下. 10 ^ x次方肯定是x + 1位的 所以底数肯定小于10的 那么我们就枚举1~9为底数 然后枚举幂级数就行了,直至不满足题目中的条件即可break cnt = 0 for ...

随机推荐

  1. union /union all/ intersect / minus

  2. ue4同c#通信时的中文乱码问题

    转:https://blog.csdn.net/XIAOZHI0999/article/details/80785570 本文讨论C#同ue4进行通信,出现的中文乱码情况,其他语言类似. 本文分两种情 ...

  3. pillow模块

    pillow模块 用于操作图片的模块 安装 pip install pillow 生成验证码 from PIL import Image,ImageDraw,ImageFont from io imp ...

  4. docker容器时区问题

    原文:docker容器时区问题 版权声明:本文为博主原创文章,随意转载. https://blog.csdn.net/Michel4Liu/article/details/80890868 本系列目录 ...

  5. 学习es6

    #第一节 初始化项目 npm init -y 安装babel-cli npm install -g babel-cli npm install --save-dev babel-preset-es20 ...

  6. 并发模式与 RPS 模式之争,性能压测领域的星球大战

    本文是<如何做好性能压测>系列专题分享的第四期,该专题将从性能压测的设计.实现.执行.监控.问题定位和分析.应用场景等多个纬度对性能压测的全过程进行拆解,以帮助大家构建完整的性能压测的理论 ...

  7. Function相关的小知识

      重载 相同函数名,不同参数列表的多个函数,在调用时可自动根据传入参数的不同,选择对应的函数执行.为什么使用重载:                   减轻API的名字,减轻调用者的负担.何时使用重 ...

  8. python中sort排序

    排序并且改变自身结果: nums.sort()

  9. IO流理解方式小结

    从业以来一直对IO不甚了解,每次看到都头疼不已,最近有时间小小的总结一下,下面以FileIO流为]; //文件输入流 FileInputStream in = new FileInputStream( ...

  10. 帮助你构建云服务的开源平台:openstack

    from:http://os.51cto.com/art/201205/336386_all.htm 概念架构 3-5 OpenStack Compute服务架构 点评:从openstack的能力来看 ...