I have analyzed the problem so many times and tried to make the solution better and I am getting the correct results but when I click on submit, it is giving me wrong answer!!
Please help me!
[simon@simon-laptop][12:17:52]
[~/tmp/DONTSYNC/hackerrank/otherpeoples]>./compile-latest-cpp.sh
Compiling abhi_rex1-WALKFAST.cpp
+ g++ -std=c++14 abhi_rex1-WALKFAST.cpp -O3 -g3 -Wall -Wextra -Wconversion -DONLINE_JUDGE -D_GLIBCXX_DEBUG -fsanitize=undefined -ftrapv
abhi_rex1-WALKFAST.cpp: In function ‘int main()’:
abhi_rex1-WALKFAST.cpp:27:25: warning: ‘d2’ may be used uninitialized in this function [-Wmaybe-uninitialized]
count1 = (abs(d2-d1))*(p);
~~^~~
abhi_rex1-WALKFAST.cpp:27:25: warning: ‘d1’ may be used uninitialized in this function [-Wmaybe-uninitialized]
+ set +x
Successful
Your solution gives me a different answer every time for the following test input:
Thank You @ssjgz !!
It was really helpful … I have done some changes in the code accordingly …Now I am getting the result as correct answer… Thank you so much!