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

×

GOOGOL01 - Editorial

PROBLEM LINK: Practice, Contest

CATEGORY: EASY-MEDIUM

PRE-REQUISITES: Modulo Concepts.

PROBLEM:
You need to solve the A.G.P :

$ \left \{ \sum_{i=0}^{n}\left ( \left [ a+i\cdot d \right ] \cdot x^{n-i}\right ) \right \} mod \ 215372682525 $

EXPLAINATION:
It is a simple mathematics question. Here, you need to calculate the sum mod 215372682525 as mentioned above. But, keep in mind that 215372682525^2 = 46385392378014440375625, which is greater than 2^64. Therefore, all you need to do is calculate the value of x^0, x^1, x^2, x^3, x^4, ..., x^n and simultaneously take the mod with 215372682525 and save the mod value at corresponding index i. Similarly, do the same for a + id for each value of i and save the mod value at corresponding index i. Now, multiply a + id with the corresponding x^(n-i) value and take the mod and save the mod value at corresponding index i. Finally, add them and simultaneously take the mod.

C++ CODE:
Link

Author: Suraj Singh
Tester: Naman Taneja
Editorialist: Suraj Singh

This question is marked "community wiki".

asked 21 May '15, 15:26

surajjumpy's gravatar image

3★surajjumpy
63
accept rate: 0%

edited 21 May '15, 18:14

admin's gravatar image

0★admin ♦♦
19.8k350498541

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:

×15,852
×1,723
×348
×5
×5

question asked: 21 May '15, 15:26

question was seen: 645 times

last updated: 21 May '15, 18:14