/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
double y = sc.nextDouble();
if (x % 5==0 && (x+0.50)<=y){
double balance = y-(x+0.50);
System.out.printf("%.2f",balance);
}
else{
System.out.printf("%.2f",y);
}
}
}
i have same code as of you .It is successfully executed also,but after submitting it they give wrong answer. can you tell what’s the problem
Hi @amit_behera
This video was very helpful for my understanding,
https://youtu.be/vMuZX3Nh8Lc
here’s a python code snippet
n, m = map(float, input().split())
if n % 5 == 0 and n + 0.5 <= m:
print(m - n - 0.5)
else:
print(m)
We can solve this problem by having just two statements in the IF condition.
Buddy compare ur code with my code side by side definitely you will get it…
otherwise reply your soution here…i will help you to find out the prolem