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.
Submitting an official solution before solving the problem yourself is a bannable offence.
- Write a procedure to compute for single digits:
- Repeat multiplies until it loops (after at most
muls)
- Use offset and period length to compute the result
- Repeat multiplies until it loops (after at most
- Write a procedure to compute for single digits:
where
wraps to
; and
means "
"
times (as above)
- Compute loop similarly (can be as long as
)
- Compute loop similarly (can be as long as
- Compute the result digit by digit using two of the above procedures
- For a digit
, round the number
up and
down to the nearest multiple of
- Represent the number range
as:
- For a digit
Comments