Skip to content

Instantly share code, notes, and snippets.

@lifez
Created March 25, 2013 16:29
Show Gist options
  • Select an option

  • Save lifez/5238433 to your computer and use it in GitHub Desktop.

Select an option

Save lifez/5238433 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int main(){
int x;
float y;
scanf("%d %f",&x,&y);
if(x%5==0&&0.5<=y-x){
printf("%.2f",y-x-0.5);
}
else{
printf("%.2f",y);
}
return 0;
}
import java.util.Scanner;
class main{
public static void main(String[] arg){
Scanner in = new Scanner(System.in);
int x;
float y;
x = in.nextInt();
y = in.nextFloat();
if (x%5==0 && x+0.5<=y){
System.out.format("%.2f\n",y-(x+0.5));
}
else{
System.out.format("%.2f\n",y);
}
}
}
x,y = raw_input().split()
x=int(x)
y=float(y)
if x%5==0 and y-0.5>=float(x) and x!=0:
print format(y-x-0.50,".2f")
else:
print format(y,".2f")
a = gets.chomp.split
x = a[0].to_f
y = a[1].to_f
if x % 5 == 0 and y > (x+0.50)
y = y-x-0.50
end
puts "%.2f" %y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment