Advertisement
Guest User

Untitled

a guest
Feb 24th, 2013
890
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. /**
  2.  * Created with IntelliJ IDEA.
  3.  * User: Fcdkbear
  4.  * Date: 11.02.13
  5.  * Time: 16:48
  6.  * To change this template use File | Settings | File Templates.
  7.  */
  8.  
  9. import java.util.Scanner;
  10. public class test {
  11.     public static void main(String [] args)
  12.     {
  13.         Scanner sc=new Scanner(System.in);
  14.         int n=sc.nextInt();
  15.         int T=sc.nextInt();
  16.         int res=-2000000000;
  17.         for (int i = 0; i<n; ++i)
  18.         {
  19.             int f=sc.nextInt();
  20.             int t=sc.nextInt();
  21.             int cur=f;
  22.             if (t>T)
  23.                 cur-=(t-T);
  24.             res=Math.max(res,cur);
  25.         }
  26.         System.out.println(res);
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement