5 条题解

  • 4
    @ 2024-4-6 12:37:51

    #include <bits/stdc++.h>
    using namespace std;
    int main()
    {
        double sum = 0;
        int n, a[200];
        cin >> n;
        for (int i = 1; i <= n; i++)
        {
            cin >> a[i];
            sum += a[i];
        }
        cout << sum << endl << fixed << setprecision(2) << sum / n << endl;
        sort(a + 1, a + n + 1);
        for (int i = n; i >= 1; i--)
        {
            cout << a[i] << " ";
        }
        return 0;
    }
    

    • 1
      @ 2023-7-14 18:49:29
      #include <bits/stdc++.h>
      using namespace std;
      int main(){
          double n,sum=0,a[150];
          cin>>n;
          for(int i=0;i<n;i++){
              cin>>a[i];
              sum+=a[i];
          }
          cout<<sum<<endl;
          printf("%.2f",sum/n);
          cout<<endl;
          for(int i=n-1;i>-1;i--)cout<<a[i]<<' ';
          return 0;
      }
      
      • -1
        @ 2023-4-15 8:52:58
        #include<bits/stdc++.h>
        using namespace std;
        int n,a[200],ans;
        int main()
        {
            cin>>n;
            for (int i=1;i<=n;i++)
            {
                cin>>a[i];
                ans+=a[i];
            }
            sort(a+1,a+n+1);
            cout<<ans<<fixed<<setprecision(2)<<'\n'<<1.0*ans/n<<'\n';
            for (int i=n;i>=1;i--)
                cout<<a[i]<<" ";
            return 0;
        }
        • -1
          @ 2023-1-19 20:49:44
          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
              int n,a[155];
              double sum=0;
              cin >> n;
              for(int i=1;i<=n;i++)
              {
                  cin >> a[i];
                  sum+=a[i];
              }
              sort(a+1,a+n+1);
              cout << sum << endl;
              cout << fixed << setprecision(2) << sum/n << endl;
              for(int i=n;i>=1;i--)
              {
                  cout << a[i] << " ";
              }
          }
          
          • -1
            @ 2023-1-19 14:27:09
            #include<bits/stdc++.h>
            using namespace std;
            int a[160], n, sum, i;
            int main()
            {
            	cin >> n;
            	for(i = 1; i <= n; i++){
            		cin >> a[i];
            		sum += a[i];
            	}
            	sort(a+1,a+1+n);
            	cout << sum << endl;
            	printf("%.2f\n",sum*1.0/n);
            	for(i = n; i >= 1; i--){
            		cout << a[i] << " ";
            	}
            	return 0;
            }
            
            
            • 1

            信息

            ID
            175
            时间
            1000ms
            内存
            64MiB
            难度
            2
            标签
            递交数
            93
            已通过
            57
            上传者