Answers for "Uri/Beecrowd Problem no - 1185 Solution in Java"

0

Uri/Beecrowd Problem no - 1185 Solution in Java

import java.util.Scanner;
public class Main{
    public static void main (String[] args) {
        Scanner obj = new Scanner(System.in);
        double M[][] = new double[12][12];
        double sum = 0.0;
        int i,j,counter = 1;
        String O = obj.next();
        
        for(i = 0; i < 12; i++){
            for(j = 0; j < 12; j++){
                M[i][j] = obj.nextDouble();
            }
        }
        for(i = 10; i >= 0; i--){
            for(j = 0; j < counter; j++){
                sum += M[i][j];
            }
            counter++;
        }
        if(O.equals("S")){
            System.out.printf("%.1f\n", sum);
        }else if(O.equals("M")){
            System.out.printf("%.1f\n", sum/66.0);
        }
    }
}
Posted by: Guest on March-01-2022

Code answers related to "Uri/Beecrowd Problem no - 1185 Solution in Java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language