import java.io.BufferedReader;
import java.io.InputStreamReader;
public class Main
{
public static void main(String args[])throws Exception
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
try
{
double w=Double.parseDouble(br.readLine());
double b=Double.parseDouble(br.readLine());
if(b>w)
{
if(w%5==0)
{
double a=w+0.50;
if(b>=a)
{
System.out.printf("%.2f",b-w-0.50);
}
else
{
System.out.printf("%.2f",b);
}
}
else
{
System.out.printf("%.2f",b);
}
}
else
{
System.out.printf("%.2f",b);
}
}
catch(Exception e)
{
e.printStackTrace();
}finally{
br.close();
}
}
}
what’s wrong with my answer, why is it giving wrong answer every time?