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

×

Why am I getting TLE in folllowing code?

I am trying to solve http://www.spoj.com/problems/PAGAIN/en/ and in the comments people have said they used Miller Rabin. So I studied it and implemented it. I am getting TLE. Am I supposed to use some different algorithm or I need some optimization tricks?

My code : http://ideone.com/Zs26PV

This is my first Miller Rabin implementation

asked 19 Oct '15, 16:39

dragonemperor's gravatar image

3★dragonemperor
89321134
accept rate: 10%

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:

×1,114
×16

question asked: 19 Oct '15, 16:39

question was seen: 381 times

last updated: 19 Oct '15, 16:39