Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

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
", sum);
        }else if(O.equals("M")){
            System.out.printf("%.1f
", sum/66.0);
        }
    }
}
Source by www.beecrowd.com.br #
 
PREVIOUS NEXT
Tagged: #Problem #Solution #Java
ADD COMMENT
Topic
Name
4+5 =