zoukankan      html  css  js  c++  java
  • ProjectEuler 125

    http://projecteuler.net/index.php?section=problems&id=125

    Problem 125

    04 August 2006

    The palindromic number 595 is interesting because it can be written as the sum of consecutive squares: 6^2+7^2+8^2+9^2+10^2+11^2+12^2

    There are exactly eleven palindromes below one-thousand that can be written as consecutive square sums, and the sum of these palindromes is 4164. Note that 1 = 0^2+1^2 was not been included as this problem is concerned with the squares of positive integers.

    Find the sum of all the numbers less than 108  that are both palindromic and can be written as the sum of consecutive squares.

    Answer:
    2906969179

    It returns:

    Sum=2906969179
    Count=166
    Max:97299279=312^2+313^2+314^2+315^2+316^2+317^2+318^2+319^2+320^2+321^2+322^2+323^2+324^2+325^2+326^2+327^2+328^2+329^2+330^2+331^2+332^2+333^2+334^2+335^2+336^2+337^2+338^2+339^2+340^2+341^2+342^2+343^2+344^2+345^2+346^2+347^2+348^2+349^2+350^2+351^2+352^2+353^2+354^2+355^2+356^2+357^2+358^2+359^2+360^2+361^2+362^2+363^2+364^2+365^2+366^2+367^2+368^2+369^2+370^2+371^2+372^2+373^2+374^2+375^2+376^2+377^2+378^2+379^2+380^2+381^2+382^2+383^2+384^2+385^2+386^2+387^2+388^2+389^2+390^2+391^2+392^2+393^2+394^2+395^2+396^2+397^2+398^2+399^2+400^2+401^2+402^2+403^2+404^2+405^2+406^2+407^2+408^2+409^2+410^2+411^2+412^2+413^2+414^2+415^2+416^2+417^2+418^2+419^2+420^2+421^2+422^2+423^2+424^2+425^2+426^2+427^2+428^2+429^2+430^2+431^2+432^2+433^2+434^2+435^2+436^2+437^2+438^2+439^2+440^2+441^2+442^2+443^2+444^2+445^2+446^2+447^2+448^2+449^2+450^2+451^2+452^2+453^2+454^2+455^2+456^2+457^2+458^2+459^2+460^2+461^2+462^2+463^2+464^2+465^2+466^2+467^2+468^2+469^2+470^2+471^2+472^2+473^2+474^2+475^2+476^2+477^2+478^2+479^2+48
    0^2+481^2+482^2+483^2+484^2+485^2+486^2+487^2+488^2+489^2+490^2+491^2+492^2+493^2+494^2+495^2+496^2+497^2+498^2+499^2+500^2+501^2+502^2+503^2+504^2+505^2+506^2+507^2+508^2+509^2+510^2+511^2+512^2+513^2+514^2+515^2+516^2+517^2+518^2+519^2+520^2+521^2+522^2+523^2+524^2+525^2+526^2+527^2+528^2+529^2+530^2+531^2+532^2+533^2+534^2+535^2+536^2+537^2+538^2+539^2+540^2+541^2+542^2+543^2+544^2+545^2+546^2+547^2+548^2+549^2+550^2+551^2+552^2+553^2+554^2+555^2+556^2+557^2+558^2+559^2+560^2+561^2+562^2+563^2+564^2+565^2+566^2+567^2+568^2+569^2+570^2+571^2+572^2+573^2+574^2+575^2+576^2+577^2+578^2+579^2+580^2+581^2+582^2+583^2+584^2+585^2+586^2+587^2+588^2+589^2+590^2+591^2+592^2+593^2+594^2+595^2+596^2+597^2+598^2+599^2+600^2+601^2+602^2+603^2+604^2+605^2+606^2+607^2+608^2+609^2+610^2+611^2+612^2+613^2+614^2+615^2+616^2+617^2+618^2+619^2+620^2+621^2+622^2+623^2+624^2+625^2+626^2+627^2+628^2+629^2+630^2+631^2+632^2+633^2+634^2+635^2+636^2+637^2+638^2+639^2+640^2+641^2+642^2+643^2+644^2+645^2+646^2+647^2+648^2+649^2+650^2
    +651^2+652^2+653^2+654^2+655^2+656^2+657^2+658^2+659^2+660^2+661^2+662^2+663^2+664^2+665^2+666^2+667^2+668^2+669^2+670^2+671^2+672^2+673^2+674^2+675^2+676^2+677^2+678^2+679^2+680^2+681^2+682^2+683^2+684^2+685^2

  • 相关阅读:
    抽象工厂模式
    外观模式
    策略模式
    状态模式
    观察者模式
    装饰者模式
    模板方法模式
    适配器模式
    中介者模式
    组合模式
  • 原文地址:https://www.cnblogs.com/fengju/p/6336189.html
Copyright © 2011-2022 走看看