URI Problem (Right Area) 1190:
Right Area is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.
import java.util.Scanner; /** * @Author : Muhammad Harun-Or-Roshid * @Date : Oct 28, 2016 * @Time : 4:04:11 PM */ public class Uri1190 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double m[][] = new double[12][12]; double sum = 0; int count = 0; String v = sc.next(); for (int i = 0; i < m.length; i++) { for (int j = 0; j < m.length; j++) { double x = sc.nextDouble(); m[i][j] = x; if (j > m.length - i - 1 && i < j) { sum += x; count++; } } } if (v.equals("S")) { System.out.printf("%.1f\n", sum); } else { System.out.printf("%.1f\n", (sum / count)); } } }