Advertisement
Guest User

Untitled

a guest
Jun 20th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  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. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement