Advertisement
Guest User

Untitled

a guest
Nov 12th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class Practicer {
  4.  
  5. public static void main(String[] args) {
  6. Scanner cin = new Scanner(System.in);
  7.  
  8. while(cin.hasNext()){
  9. int a = cin.nextInt();
  10. int b = cin.nextInt();
  11.  
  12. if( (a%2!=0) && (b%2!=0) )
  13. {
  14. System.out.println((b-a)/2);
  15. }
  16. else{
  17. System.out.println((b-a)/2+1);
  18. }
  19. }
  20.  
  21. }
  22.  
  23. }
  24.  
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement