I am having trouble while submitting my answers. The sites says wrong ans even though i have checked my answer on ideone with the same input as provided by this site. And another thing if u run the program please correct the"--"sign it is showing only"-"

using namespace std;
int main()
int t,m,n,k;
else if(n<m)


Ig t- will be t-- and same for k-

yes i know and in my program it is - - but while submitting here this happened… sorry and thanks alot for your concern. please can you do it urslef when you are runing and then tell me maybe…

Do post a link to the question you have a query about.
Also posting a link to your submitted code is always better than pasting your code here and expecting someone to help :slight_smile:

1 Like

here is the link:

Have a look at this.

  1. You are missing out the case where you already have m = n and you have to do nothing with your k coins.
  2. Also, by applying while loop in your code, you are exhausting all your coins. But that is not necessary. You always want to save the money you have right?

okay… thanks btw my question remains… that for the input provided by the site my program gives the same ans as that of the output provided. WHY IS THAT. btw thank you very much for your concern this will help me in my future programs…

The input provided by the site are known as ‘Sample Test Cases’. Your program will run against each test case of the problem the system contains. If it passes all of them, you will get an AC, if it fails on any one, you will get a WA or any other verdict.
Hope this helps :slight_smile:

1 Like

Consider the input 5 5 3, m and n are already equal so you need not spend any coins and the output should be 0.
But your code produces 1 as output. This is just one such example where your code fails. There’ll be many others…

1 Like