You are not logged in. Please login at to post your questions!


Confusion in YVNUM solution Dec18 cookoff

Here is the link to the Problem and Solution of December cook-off YVNUM.
There is one thing in this solution which i cant get my head around - when the number becomes too big we take the modulo of the number wrt to 1000000007 instead of the original number and then do the concatenation operation with it rather than the original number and then expect the answer to be same, will it work??

Ex. string 921, modulo number = 103
921%103 = 97 but we find that (921219192)%103 != (977997)%103
Please tell me where am i wrong.

asked 24 Dec '18, 18:51

vaibnak7's gravatar image

accept rate: 0%

We first try to represent the number as sum of several numbers. Now, as the numbers become large, we take the modulo of the component numbers instead of the digits.

So, to find modulo of (921219192), we break it as

a = 921 * 10^6
b = 219 * 10^3
c = 192 * 10^0

So,921219192 = a + b + c

So, now the answer is (a%103+ b%103 + c%103)%103.

And I don't think that just taking modulo of each cyclic shift and then concatenating it would work.


answered 24 Dec '18, 19:01

masood786's gravatar image

accept rate: 13%

edited 24 Dec '18, 19:09

toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 24 Dec '18, 18:51

question was seen: 98 times

last updated: 24 Dec '18, 19:09