Created
March 25, 2013 16:29
-
-
Save lifez/5238433 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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