提交时间:2022-07-13 11:55:06
运行 ID: 51594
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll n,k,w[505][505],ans,a[505]; int main() { cin>>n>>k; for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) cin>>w[i][j],ans+=w[i][j],a[i]+=w[i][j]; ll minn=a[1]; ans/=2; //cout<<ans<<endl; for(int i=2; i<=n; i++) minn=min(minn,a[i]); // cout<<minn<<endl; cout<<ans-minn+(n-1)*k-minn<<endl; return 0; } //ans-minn+n*k-k-k