杭电 2023 ( 求平均成绩 ) java
2017-01-24 16:43
225 查看
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); while (sc.hasNext()) { int n = sc.nextInt(); int m = sc.nextInt(); double ave = 0; double ave2 = 0; int count = 0; int count2 = 0; int t = 0; double save[] = new double[m]; double save1[] = new double ; int arr[][] = new int[50][5]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { arr[i][j] = sc.nextInt(); } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { ave += arr[i][j]; count++; if (count == m) { save1[i] = ave / m; if (i == 0) { System.out.printf("%.2f", save1[i]); } else { System.out.printf(" " + "%.2f", save1[i]); } ave = 0; count = 0; } } } System.out.println(); for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { ave2 += arr[j][i]; count2++; if (count2 == n) { save[i] = ave2 / n; if (i == 0) { System.out.printf("%.2f", save[i]); } else { System.out.printf(" " + "%.2f", save[i]); } ave2 = 0; count2 = 0; } } } System.out.println(); int count3 = 0; int q = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { if (arr[i][j] >= save[j]) { count3++; } } if (count3 == m) { q++; } count3 = 0; } System.out.println(q); System.out.println(""); } } }
相关文章推荐
- 求平均成绩 【杭电-HDOJ-2023】 附题+详解
- 杭电ACM 2023 求平均成绩
- 杭电ACM 2023 求平均成绩
- 杭电2023求平均成绩
- 求平均成绩(杭电2023)(确实很水很繁琐)
- (Java实现) HDOJ 2023 求平均成绩 面向对象设计思想
- 【杭电oj2023】求平均成绩
- 杭电 2023 求平均成绩
- hdu 2023 求平均成绩 java数组练手- -
- 【杭电】[2023]求平均成绩
- 杭电ACM 2023:求平均成绩
- 杭电 2023 求平均成绩
- 杭电 2023 求平均成绩 (二维数组的简单运用)
- 杭电2023求平均成绩
- 杭电ACM 2023 求平均成绩
- 杭电OJ-2023_求平均成绩
- 求平均成绩 杭电2023
- 杭电HDOJ2023-求平均成绩
- 杭电acm 2023 求平均成绩
- hdu 2023 求平均成绩 (java)