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

×

Need Help #PRMDIV problem

problem url https://www.codechef.com/problems/PRMDIV

Can anyone help and chk my solution for above problem I am getting only one input test incorrect and rest all are correct can anyone chk my code and help me??

solution link: https://www.codechef.com/viewsolution/19404205

asked 31 Jul '18, 00:27

munjal1997's gravatar image

0★munjal1997
32
accept rate: 0%

edited 31 Jul '18, 00:29


freq is integer array multiplying 2 of them might cause overflow.

AC code:https://www.codechef.com/submit/complete/19404484

link

answered 31 Jul '18, 00:43

praveenkumar12's gravatar image

5★praveenkumar12
29819
accept rate: 8%

link

answered 31 Jul '18, 00:29

aryanc403's gravatar image

5★aryanc403
2.4k1516
accept rate: 11%

changed it to long freq and got correct but I didn't got your point if you could elaborate how freq would get overflow if my freq count will always be less than 1000000 and my variable count which multiplies freq is already long.

link

answered 31 Jul '18, 00:48

munjal1997's gravatar image

0★munjal1997
32
accept rate: 0%

edited 31 Jul '18, 00:53

Read type conversion in JAVA and C++. First, freq[i] is int. Intermediate-Product of 2 int is stored in int. Overflow happens. Then this overflowed result stored in count.

(31 Jul '18, 01:02) vijju123 ♦♦4★
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:

×145
×2

question asked: 31 Jul '18, 00:27

question was seen: 103 times

last updated: 31 Jul '18, 01:02