daily pastebin goal
20%
SHARE
TWEET

Untitled

a guest Jun 20th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package testProje;
  2. import java.util.Scanner;
  3.  
  4. public class problemB {
  5.     public static void main(String[] args) {
  6.         Scanner sc = new Scanner(System.in);
  7.         while(sc.hasNext()) {
  8.             double x1 = sc.nextDouble();
  9.             double y1 = sc.nextDouble();
  10.             double x2 = sc.nextDouble();
  11.             double y2 = sc.nextDouble();
  12.             double p = sc.nextDouble();
  13.            
  14.             double cal = (double) (Math.pow((x1-x2), p) + Math.pow((y1-y2), p));
  15.             double ans = (double) Math.pow(cal, (1/p));
  16.             System.out.printf("%.10f \n", (Math.abs(ans)));
  17.         }
  18.         sc.close();
  19.     }  
  20. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top