Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Soal No.1
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- long N;
- double x,y;
- N = input.nextLong();
- x = input.nextInt();
- y = input.nextInt();
- x=x-5;
- y=y+5;
- double hasil =(double)y*N/100.0f;
- System.out.printf("%.2f",hasil);
- }
- }
- Soal No.2
- import java.lang.Math;
- import java.util.Scanner;
- public class Solution {
- public static void main(String[] args)
- {
- Scanner input = new Scanner(System.in);
- double x1,x2,y1,y2;
- x1 = input.nextLong();
- y1 = input.nextLong();
- x2 = input.nextLong();
- y2 = input.nextLong();
- double x11,x22,y11,y22;
- x11=x1*95f/100;
- x22=x2*95f/100;
- y11=y1*95f/100;
- y22=y2*95f/100;
- x1 = x2-x1;
- y1 = y2-y1;
- x11 = x22-x11;
- y11 = y22-y11;
- double jarak = 1f*(x1*x1)+(y1*y1);
- jarak = Math.sqrt(jarak);
- System.out.println(jarak);
- double jarak2 = 1f*(x11*x11)+(y11*y11);
- jarak2 = Math.sqrt(jarak2);
- System.out.println(jarak2);
- System.out.printf("%.2f",(jarak-jarak2));
- }
- }
Add Comment
Please, Sign In to add comment