DIV + MOD solution codeforces – The number 𝑎a is fixed and known to Vlad. Help Vlad find the maximum value of 𝑓𝑎(𝑥)fa(x) if 𝑥x can take any integer value from 𝑙l to 𝑟r inclusive (𝑙≤𝑥≤𝑟l≤x≤r).

DIV + MOD solution codeforces Not so long ago, Vlad came up with an interesting function: 𝑓𝑎(𝑥)=⌊𝑥𝑎⌋+𝑥mod𝑎fa(x)=⌊xa⌋+xmoda, where ⌊𝑥𝑎⌋⌊xa⌋ is 𝑥𝑎xa, rounded down, 𝑥mod𝑎xmoda — the remainder of the integer division of 𝑥x by 𝑎a. For example, with 𝑎=3a=3 and 𝑥=11x=11, the value 𝑓3(11)=⌊113⌋+11mod3=3+2=5f3(11)=⌊113⌋+11mod3=3+2=5. The number 𝑎a is fixed and known to Vlad. Help Vlad find the maximum value of 𝑓𝑎(𝑥)fa(x) if 𝑥x can take any integer value from 𝑙l to 𝑟r inclusive (𝑙≤𝑥≤𝑟l≤x≤r). DIV + MOD solution … Read more