3 条题解

  • 1

    #include<bits/stdc++.h> using namespace std; long long n, i; double num, s; int main() {

    cin >> n;
    for(i = 0;i < n;i++)
    {
        cin >> num;
        s += num;
    }
    cout << fixed << setprecision(2) << s / n;
    return 0;
    

    }****

    • 0
      @ 2025-1-27 19:37:01
      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n;
          cin >> n;
          int x = n;
          int t;
          int sum = 0;
          while (n--)
          {
              cin >> t;
              sum += t;
          }
          cout << fixed << setprecision(2) << (double)sum / x;
          return 0;
      }
      
      • 0
        @ 2024-10-25 14:40:38
        #include <iostream>
        #include <iomanip>
        using namespace std;
        int main() {
        	double n,a,sum = 0,ans = 0;
        	cin >> n;
        	for (int i = 1;i <= n;i++) {
        		cin >> a;
        		sum += a;
        	}
        	ans = sum / n;
        	cout << fixed << setprecision(2) << ans << endl;
        	return 0;
        }
        
        • 1

        信息

        ID
        4504
        时间
        1000ms
        内存
        128MiB
        难度
        1
        标签
        (无)
        递交数
        79
        已通过
        45
        上传者