#include<cstdio> #include<algorithm> #include<cassert> #include<complex> #include<map> #include<iomanip> #include<sstream> #include<queue> #include<set> #include<string> #include<vector> #include<iostream> #include<cstring> #include<stack> #define FOR(i, a, b) for(int i =(a); i <=(b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define fup FOR #define fdo FORD #define REP(i, n) for(int i = 0;i <(n); ++i) #define VAR(v, i) __typeof(i) v=(i) #define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define siz SZ #define CLR(x) memset((x), 0, sizeof(x)) #define PB push_back #define MP make_pair #define X first #define Y second #define FI X #define SE Y #define SQR(a) ((a)*(a)) #define DEBUG 1 #define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; } #define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cout <<endl; }} using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int>P; typedef vector<int>VI; const int INF=1E9+7; template<class C> void mini(C&a4, C b4){a4=min(a4, b4); } template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); } int n,k; const int MAX_SETS = 5; const int MAX_LEN = 100*1000; LL a[MAX_SETS+2][MAX_LEN+7]; int main(){ ios_base::sync_with_stdio(false); cout << setprecision(15) << fixed; cin>>n>>k; FOR(i,1,k) FOR (j,1,n) cin>>a[i][j]; FOR(i,1,n) {LL s=0; FOR (j,1,k) s+=a[j][i]; cout<<s/k<<" ";} cout<<endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | #include<cstdio> #include<algorithm> #include<cassert> #include<complex> #include<map> #include<iomanip> #include<sstream> #include<queue> #include<set> #include<string> #include<vector> #include<iostream> #include<cstring> #include<stack> #define FOR(i, a, b) for(int i =(a); i <=(b); ++i) #define FORD(i, a, b) for(int i = (a); i >= (b); --i) #define fup FOR #define fdo FORD #define REP(i, n) for(int i = 0;i <(n); ++i) #define VAR(v, i) __typeof(i) v=(i) #define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i) #define ALL(x) (x).begin(), (x).end() #define SZ(x) ((int)(x).size()) #define siz SZ #define CLR(x) memset((x), 0, sizeof(x)) #define PB push_back #define MP make_pair #define X first #define Y second #define FI X #define SE Y #define SQR(a) ((a)*(a)) #define DEBUG 1 #define debug(x) {if (DEBUG)cerr <<#x <<" = " <<x <<endl; } #define debugv(x) {if (DEBUG) {cerr <<#x <<" = "; FORE(it, (x)) cerr <<*it <<", "; cout <<endl; }} using namespace std; typedef long long LL; typedef long double LD; typedef pair<int, int>P; typedef vector<int>VI; const int INF=1E9+7; template<class C> void mini(C&a4, C b4){a4=min(a4, b4); } template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); } int n,k; const int MAX_SETS = 5; const int MAX_LEN = 100*1000; LL a[MAX_SETS+2][MAX_LEN+7]; int main(){ ios_base::sync_with_stdio(false); cout << setprecision(15) << fixed; cin>>n>>k; FOR(i,1,k) FOR (j,1,n) cin>>a[i][j]; FOR(i,1,n) {LL s=0; FOR (j,1,k) s+=a[j][i]; cout<<s/k<<" ";} cout<<endl; return 0; } |