1 条题解
-
0
C :
#include<stdio.h> int main() { int n; scanf("%d",&n); int i,j,a[n][3]; for(i=0;i<n;i++){ for(j=0;j<3;j++){ scanf("%d",&a[i][j]); } } for(j=0;j<3;j++){ double t; int s=0; for(i=0;i<n;i++){ s+=a[i][j]; t=(double)s/n; } printf("%.1f ",t); } return 0; }
C++ :
#include <bits/stdc++.h> using namespace std; int main(){ int a[100][3]; int n,i,j,s; double v; cin>>n; for(i = 0;i < n;i++){ for(j = 0;j < 3;j++){ cin>>a[i][j]; } } //先循环科目 for(j = 0;j < 3;j++){ s = 0; //再循环人 for(i = 0;i < n;i++){ //cout<<a[i][j]<<" "; s = s + a[i][j]; } v = s * 1.0 / n;//n个科目的成绩 cout<<fixed<<setprecision(1)<<v<<" "; } }
Python :
n = int(input()) a = [[0 for j in range(3)] for i in range(n)] yw = 0 sx = 0 yy = 0 for i in range(n): t = input().split() for j in range(3): a[i][j] = int(t[j]) for i in range(n): yw += a[i][0] sx += a[i][1] yy += a[i][2] print('%.1f %.1f %.1f' % (yw / n, sx / n, yy / n), end='')
- 1
信息
- ID
- 2185
- 时间
- 1000ms
- 内存
- 16MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者