HS08TEST: Time Limit Exceeded

Getting Time Limit Exceeded Please Help.

My Answer Is:-

#include

using namespace std;

int main()
{
int x,y,p;

// x is the money to be withdrawn
//y is the initial bank account

cin>>x>>y;
while(x!=0)
{
if((x%5==0) && (x<y))
{
p=y-(x+0.50);//p is the final account balance
cout<<p<<endl;}
else
{cout<<y<<endl;}
cin>>x>>y;
}
}

Any Help Will Be Highly Helpful.

Please Do Help.

Your code is wrong because Pooja’s initial account balance is in float number.
check it my solution -

 http://www.codechef.com/viewsolution/4122388 
1 Like