Hot Search : Source embeded web remote control p2p game More...
Location : Home Downloads SourceCode Windows Develop

correct_SquareDigits

  • Category : Windows Develop
  • Tags :
  • Update : 2012-11-26
  • Size : 1kb
  • Downloaded :0次
  • Author :tras****
  • About : Nobody
  • PS : If download it fails, try it again. Download again for free!
Download1 Download2
Don't use download software fo downloading.
If download fail,Try it again for free.
Introduction - If you have any usage issues, please Google them yourself
Class Name: SquareDigits Method Name: smallestResult Parameters: int Returns: int Define the function S(x) as the sum of the squares of the digits of x. For example: S(3)=3*3=9 and S(230)=2*2+3*3+0*0=13. Define the set T(x) to be the set of unique numbers that are produced by repeatedly applying S to x. That is: S(x), S(S(x)), S(S(S(x))), etc... For example, repeatedly applying S to 37: S(37)=3*3+7*7=58. S(58)=5*5+8*8=89. S(89)=145. S(145)=42. S(42)=20. S(20)=4. S(4)=16. S(16)=37. Note this sequence will repeat so we can stop calculating now and: T(37)={58,89,145,42,20,4,16,37}. However, note T(x) may not necessarily contain x. Implement a class SquareDigits, which contains a method smallestResult. The method takes an int, n, as a parameter and returns the smallest int, x, such that T(x) contains n. The method signature is (be sure your method is public): int smallestResult(int n) TopCoder will ensure n is non-negative and is between 0
Packet file list
(Preview for download)
SquareDigits.h
Related instructions
  • We are an exchange download platform that only provides communication channels. The downloaded content comes from the internet. Except for download issues, please Google on your own.
  • The downloaded content is provided for members to upload. If it unintentionally infringes on your copyright, please contact us.
  • Please use Winrar for decompression tools
  • If download fail, Try it againg or Feedback to us.
  • If downloaded content did not match the introduction, Feedback to us,Confirm and will be refund.
  • Before downloading, you can inquire through the uploaded person information

Nothing.

Post Comment
*Quick comment Recommend Not bad Password Unclear description Not source
Lost files Unable to decompress Bad
*Content :
*Captcha :
CodeBus is one of the largest source code repositories on the Internet!
Contact us :
1999-2046 CodeBus All Rights Reserved.