Back to High School Physics – UVA 10071

http://uva.onlinejudge.org/external/100/10071.html
import java.util.Scanner;
public class Main {

  public static void main (String args []) {

    Scanner input = new Scanner (System.in);

    while (input.hasNext()) {
      long v,t,s;
      v = input.nextLong();
      t = input.nextLong();
      s = 2*v*t;
      if (s < 0) {
        s = -s;
        System.out.println(s);
      } else  {
        System.out.println(s);
      }
    }
  }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s