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


Same code in Java gives RE that gives AC in C++.


I was doing this question. I implemented the same codes in Java and C++. This java code gives RE while the same code when implemented in C++(here) gives AC. Why is this happening?

asked 19 Jan '14, 10:36

nikunjbanka's gravatar image

accept rate: 0%

i dont think they are quite same then

(19 Jan '14, 10:41) garakchy1★

In C++, you are using unsigned long long, but in Java you are using long. Range of unsigned long long is two times the range of long. Since, long is not sufficient for this problem and there is no concept as unsigned in Java, you should use BigInteger in Java to get AC.


answered 19 Jan '14, 11:23

kapildd's gravatar image

accept rate: 7%

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: 19 Jan '14, 10:36

question was seen: 832 times

last updated: 19 Jan '14, 11:23