1 / 3
Nov 2022

My AC code and yours give the same answer for all of my valid test cases, but we give different answers for invalid test cases. However, I’ve just used asserts to show that there are no test cases like this.

To answer your question, for test case

1000
1

I give

500
499

JULKA

There’s a fault in your subtract method.

Add this line

cout<< subtract(“50000000000005004999”, “10009998”)<< “\n”;

The expected answer is 49999999999994995001, but it gives 49999999999985995001.