You are not logged in. Please login at www.codechef.com 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. http://www.codechef.com/viewsolution/4118121

asked 20 Jun '14, 11:48

seattlecoder's gravatar image

0★seattlecoder
11
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.

link

answered 20 Jun '14, 14:21

abbas's gravatar image

4★abbas
4118
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: http://www.codechef.com/viewsolution/4120414

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

question asked: 20 Jun '14, 11:48

question was seen: 503 times

last updated: 21 Jun '14, 01:22