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


little elephant and music wrong answer

helo all, I am getting wrong answer in this question here my solution here is simple and close to the editorial the problem is easy . I tried large input and it works . if someone could tell me where I am wrong or give me a wrong test case it will be much appreciated , cheers.

asked 23 Apr '14, 09:47

muhammedabuali's gravatar image

accept rate: 0%

Your approach is correct.

This is the Accepted solution. I just changed some variable types to "long long int" and it was accepted.

If you have to multiply 2 numbers whose product cannot be stored in an int type variable, then the two numbers multiplied should also be "long long int".
For example:
if you have to perform c=a*b and a=10^9 and b=10, then a,b and c all should be "long long int" type.


answered 23 Apr '14, 12:10

roman28's gravatar image

accept rate: 19%

edited 23 Apr '14, 12:11

The answer about c = a*b is not exact. Basically only c have to be long long, because a and b fits in int, but compiler have to know, that you really do not want int overflow, but long long calculation. You can achieve this by casting or multiplying by 1LL.

Of course having all as long long is the simple and safe approach.

Your link to ideone is not working for me, but you can link to your solution in practice section ;-)

(23 Apr '14, 13:37) betlista ♦♦3★

My bad!! I forgot to make my code public.

(23 Apr '14, 14:20) roman284★

No problem, secret is almost always better than public :-D

(23 Apr '14, 17:54) betlista ♦♦3★

sorry for the late reply . but that's an annoying issue thanks

(20 May '14, 00:39) muhammedabuali0★
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: 23 Apr '14, 09:47

question was seen: 961 times

last updated: 20 May '14, 00:39