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

×

lunchtime january (LCH15JEF)

http://discuss.codechef.com/questions/62658/lch15jef -editorial this is the link to the editorial of the problem http://www.codechef.com/problems/LCH15JEF i want to ask will the method of multiplying 2 large numbers would work if two numbers are 2^36 and 2^36 , if yes please explain how will it work??

this is the template:: long long MOD; long long mult(long long A, long long B)

 {if ( B == 0 ) return 0;


long long u = mult(A, B/2);

long long res;
if ( B%2 == 0 ) 
    res = u + u;
else
    res = u + u + A;
while ( res >= MOD ) res -= MOD;
return res;

} then in which case it would work???

asked 02 Feb '15, 22:23

saisumit's gravatar image

5★saisumit
112
accept rate: 0%

edited 02 Feb '15, 22:34


How it'll work, you may refer this.

link

answered 02 Feb '15, 23:04

damn_me's gravatar image

3★damn_me
2.6k21336
accept rate: 24%

what will happen after k is more than 20, that is what will happen for this expression (987654321^(12345678912345678912))

(02 Feb '15, 23:09) saisumit5★
toggle preview
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×342
×87
×9

question asked: 02 Feb '15, 22:23

question was seen: 763 times

last updated: 02 Feb '15, 23:09