I wrote same code, one is in Python and another one is in C++. Actually I m C++ preferred coder but knows basic Python. When I wrote the code in C++, I got 20 points. I tried everything, still, I got 20 points. At last, I have to do it in python since it was a very easy Question.
Although I got 100 points for this, still want to know the reason, why my code didn’t get 100 points in C++.
in c++ i have seen this that if you try to use power function and do multiple operation in same line for large values it gives WA . your code is failing for
input :- N=18 ,A=B=D=999999999999999999
pow() returns a floating point value, and due to floating point arithmetic, it is probably 99.999 however, due to integer truncation, even 99.999… gets truncated down to 99
Hi all,
My approach was to take S as largest N digit no. possible, C as minimum N digit no. possible and then E will be simply (S-a-b-C-d), however, I was not able to pass even one test case.
eg. N = 4
a = 1234, S = 9999, b = 1111, c = 1000, d = 1423, e = s-a-b-c-d = 6231
Is there something wrong with the approach, could the tester give something that will make e become negative like a = 8000, b = 3000 ?