Editorial for ICPC NEERC 2010 B - Binary Operation


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.
  • Write a procedure to compute for single digits: a0×a×a××ac times
    • Repeat multiplies until it loops (after at most 10 muls)
    • Use offset and period length to compute the result
  • Write a procedure to compute for single digits: a0×a×(a+1)××bd times where +1 wraps to 0; and a means "a×a××a" c times (as above)
    • Compute loop similarly (can be as long as 100)
  • Compute the result digit by digit using two of the above procedures
    • For a digit i, round the number a up and b down to the nearest multiple of 10i
    • Represent the number range [a,b] as:
      • XXXaXXX
      • XXX(a+1)000
      • XXXb000
      • XXXbXXX

Comments

There are no comments at the moment.