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


MAXPR-Wrong Answer

I can't seem to find out why my answer is wrong, can someone give me a sample input for which my program prints an incorrect answer, please? Here's the link to my solution.

asked 20 Jun '14, 11:48

seattlecoder's gravatar image

accept rate: 0%

your power function has no modding and is the reason you are getting wrong ans. For large value of n you will exceed long long limit and get wrong values.


answered 20 Jun '14, 14:21

abbas's gravatar image

accept rate: 28%

edited 20 Jun '14, 14:21

So that's why it worked with my inputs but failed when I submitted it. Thank you!

(20 Jun '14, 20:39) seattlecoder0★

I made changes to the original code using mod, but I am still getting WA result when I submit my solution. (It still works with smaller values though.) Here's a link to my solution:

(21 Jun '14, 01:22) seattlecoder0★
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: 20 Jun '14, 11:48

question was seen: 503 times

last updated: 21 Jun '14, 01:22