#include
#include
using namespace std;
int main() {
int a;
float c;
double b;
cin>>a;
cin>>c;
if ((a<c)&(a%5==0))
{
b=c-a-0.5;
cout<<fixed<<setprecision(2)<<b;
}
else
{
b=c;
cout<<fixed<<setprecision(2)<<b;
}
return 0;
}
The codechef run ompile shows the correct anwer, but after sbmssion it shows wrong answer. HELP
in:
if ((a<c)&(a%5==0))
the condition a<c should be a<=c-0.5 since you would need to subtract a AND 0.5 from c. Though most situations surely wouldn’t be affected much.
Hope it helps!
1 Like
#include<stdio.h>
int main(){
int X;
float Y;
scanf("%d %f",&X,&Y);
if(Y>X){
if(X%5==0){
Y=Y-X-0.50;
}
}
printf("%.2f",Y);
return 0;
}
When i click submit, it shows compilation error.Help
compile the program before submitting. Run it on “Code,Compile and Run” feature of codechef to see the error.