×

# little elephant and music wrong answer

 0 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 71●1●3●15 accept rate: 0%

 1 @muhammedabuali 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 4★roman28 1.6k●7●14●29 accept rate: 19% 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. http://ideone.com/IxnN53 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) My bad!! I forgot to make my code public. (23 Apr '14, 14:20) roman284★ 1 No problem, secret is almost always better than public :-D (23 Apr '14, 17:54) sorry for the late reply . but that's an annoying issue thanks (20 May '14, 00:39)
 toggle preview community wiki:
Preview

By Email:

Markdown Basics

• *italic* or _italic_
• **bold** or __bold__
• 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:

×3,707
×1,901
×846
×543
×110

question asked: 23 Apr '14, 09:47

question was seen: 961 times

last updated: 20 May '14, 00:39