Submit Time:2024-04-02 16:40:39

运行 ID: 44674

#include <bits/stdc++.h> using namespace std; int main(){ int m, n; cin >> m >> n; int a[m+1][n+1]; double x = 0, y = 0; for(int i=1;i<=n;i++) { for(int j=1;j<=m;j++){ cin >> a[i][j]; if(a[i][j]==1) x++; if(a[i][j]==-1) y++; } } cout << x / (n*m) << " " << y / (n*m) << endl; }