First, solve the problem. Then, write the code. ” - John Johnson

It's not at all important to get it right the first time. It's vitally important to get it right the last time. ” - Andrew Hunt and David Thomas

Wednesday, July 16, 2014

Back to High School Physics.

Author : Jisan
Programming language : Java
Difficulty : Easy
Status : Accepted
Problem number : UVA-10071
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1012

Code:

import java.util.*;
public class Uva_10071 {
    public static void main(String args[]){
    Scanner J=new Scanner(System.in);
    int output = 0;
    while(J.hasNext()){
    int a=J.nextInt();
    int b=J.nextInt();
    if(a>=-100 && a<=100){
    if(b>=0 && b<=200){
    output=2*a*b;
    }
    }
    System.out.println(output);
    }
    }
}

No comments:

Post a Comment