Subscribe For Free Updates!

We'll not spam mate! We promise.

Wednesday, December 11, 2013

Solve of lightoj problem no 1069 - Lift


import java.util.Scanner;
class Main {
    public static void main(String[] args){
    Scanner input = new Scanner(System.in);
    int a=input.nextInt();
    for(int i=1;i<=a;i++){
        int b,c,d,e,f;
         b=input.nextInt();
         c=input.nextInt();
        if(c>b)
        {
            d=((c-b)*4);
            e=(b*4);
            f=d+e+19;
        }
        else if(c<b)
        {

            d=((b-c)*4);
            e=(b*4);
            f=d+e+19;

        }
        else
        {
            d=(c*4);
           f=d+19;
        }
        System.out.println("Case "+i+": "+f);

       }

}
}




Socializer
SOCIALIZE IT →
FOLLOW US →
SHARE IT →

0 comments:

Post a Comment

Contact Form

Name

Email *

Message *