#include <bits/stdc++.h>
using namespace std;
int n, a[101][101], ans;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) cin >> a[i][j];
  for (int i = 1; i <= n; i++)
    sort(a[i] + 1, a[i] + n + 1, greater<int>());
  for (int i = 1; i <= n; i++)
    ans += i * a[i][i];
  cout << ans << endl;
  return 0;
}
C++ 取数游戏:最大总得分算法

原文地址: https://www.cveoy.top/t/topic/ob81 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录