Posts

Showing posts from February, 2020

URI_Problem_1015.java

package URI_Problem; import static java.lang.Math.sqrt; import java.util.Scanner; public class Prob_1015 {     public static void main(String[] args) {         double x1, y1, x2, y2, distance;         Scanner input = new Scanner(System.in);         x1 = input.nextDouble();         y1 = input.nextDouble();         x2 = input.nextDouble();         y2 = input.nextDouble();                 distance = sqrt(Math.pow(x2-x1,2)+(Math.pow(y2-y1,2)));         System.out.printf("%.4f\n",+distance);     } }

URI_Problem_1047.java

package URI_Problem; import java.util.Scanner; public class prob_1047_clone {     public static void main(String[] args) {         Scanner in = new Scanner(System.in);         int start_h, end_h, start_m, end_m, dur_h, dur_m;         start_h = in.nextInt();         end_h = in.nextInt();         start_m = in.nextInt();         end_m = in.nextInt();         dur_h = end_h - start_h;         if (dur_h < 0) {             dur_h += 24;         }         dur_m = end_m - start_m;         if (dur_m < 0) {             dur_m+=60;             dur_h--;         }         if(start_h == end_h && start_m == end_m)...

URI_Problem_1012_Solution.java

package URI_Problem; import java.util.Scanner; public class prob_1012 {     public static void main(String[] args) {         double pi = 3.14159;         //CALCULATION FORMULA         //triangle formula = 1/2 * A * C;         //circle formula = pi * c^2;         //trapezium formula = ((A+B)/2)*C;         //square formula = B^2;         //rectangle formula = A*B;                 Scanner in = new Scanner(System.in);         double A = in.nextDouble();         double B = in.nextDouble();         double C = in.nextDouble();                 double triangle = (1/2.0) * A * C;         double circle = pi * Math.pow(C, 2);         double trapezium =...

URI_Problem_1098_Solution_in_Java

package URI_Problem; public class prob_1098 {     public static void main(String[] args) {         float i, j, k = 0;         int l, x=2;         for (i = 0; i <= 2; i += 0.2, k += 0.2) {             for (j = 1 + k; j <= 3 + k; j++) {                 if(i==0.0 || i==1.0){                     System.out.printf("I=%.0f J=%.0f\n", i, j);                     continue;                 }                 System.out.printf("I=%.1f J=%.1f\n", i, j);             }         }         for(l=3; l<=5; l++){             System.out.printf("I=%d J=%d\n",x,l); ...