14 条题解

  • 3
    @ 2022-1-7 12:13:15
    #include <stdio.h>
    #include <math.h>
    #include <iostream>
    using namespace std;
    int main()
    {
    	double n,sum = 0,x;
    	cin >>n;
    	for(int i = 0; i < n ; i++)
    	{
    		cin >> x;
    		sum += x;
    	}
    	printf("%.2lf\n",sum/n);
    }
    
    • 2
      @ 2023-6-17 19:27:38
      /*********************************
      备注:
      *********************************/
      #include <iostream>
      #include <cstdio>
      #include <iomanip>
      #include <cmath>
      #include <math.h>
      #include <algorithm>
      #include <cstring>
      #include <string>
      #include <stack>
      #include <queue>
      #include <algorithm>
      #define LL long long
      using namespace std;
      const int INF = 0x3f3f3f3f;
      const int N = 1e5 + 10;
      double n , a[N] , m;
      double b;
      int main()
      {
      cin >> n;
      for(int i = 1; i <= n; i++)
      {
      cin >> a[i];
      }
      for(int i = 1; i <= n; i++)
      {
      m = m + a[i];
      }
      b = m / n;
      cout << fixed << setprecision(2) << b << endl;
      return 0;
      }
      
      • 2
        #include<iomanip>
        #include <iostream>
        using namespace std;
        int main()
        {
        	double n,a,s=0,sum=0;
        	cin>>n;
        	for(int i=1;i<=n;i++)
        	{
        		cin>>a;
        		s++;
        		sum+=a;	
        	}
        	cout<<fixed<<setprecision(2)<<sum/s;
        	return 0;
        }
        
        
        
        • 1
          @ 2023-7-8 9:33:20

          #include<iomanip> #include <iostream> using namespace std; int main() { double n,a,s=0,sum=0; cin>>n; for(int i=1;i<=n;i++) { cin>>a; s++; sum+=a; } cout<<fixed<<setprecision(2)<<sum/s; return 0; }

          • 1
            #include <bits/stdc++.h>//直接使用万能头
            /*#include <iostream>
            #include <stdio.h>
            #include <stdbool.h>//要定义bool型变量必须要这个
            #include <iomanip>
            #include <cstdio>
            */
            //保留小数位数代码:setiosflags(ios::fixed) << setprecision(保留小数位数) << 浮点数;
            //数组排序:升序:sort(m,m + n);降序:sort(m,m + n, greater<int>());
            
            
            //any function
            void sleep(int p){
            	long long int jiouiuiojioiouuiijyuiuyiyi = 0;
            	const int N = 1e5 + 10;
            	const int INF = 0x3f3f3f3f;
            	for(int k = 1;k <= p;k++){
            		for(int j = 1;j <= 300;j++){
            			for(int i = 1;i <= N;i++){
            			jiouiuiojioiouuiijyuiuyiyi += pow(N,N);
            			}
            		}
            	}
            }
            
            
            //code write block
            using namespace std;
            const int N = 1e5 + 10;
            const int INF = 0x3f3f3f3f;
            int main(){
            	int n,sum = 0,x;
            	double ans;
            	cin >> n;
            	for(int i = 1;i <= n;i++){
            		cin >> x;
            		sum += x; 
            	}
            	ans = 1.0 * sum / n;
            	cout << setiosflags(ios::fixed) << setprecision(2) << ans;
            	return 0;
            	}
            
            
            • 0
              @ 2024-6-12 20:10:28

              请先理解代码

              #include<cstdio>
              #include<cstdlib>
              #include<cmath>
              #include<cctype>
              #include<cstring>
              #include<string>
              #include<vector>
              #include<set>
              #include<stack>
              #include<queue>
              #include<iostream>
              #include<iomanip>
              #include<ctime>
              #include<algorithm>
              #include<map>
              using namespace std;
              int main(){
                  int n;
                  double sum=0.0;
                  cin>>n;
                  for(int i=1;i<=n;i++){
                      int a;
                      cin>>a;
                      sum+=a;
                  }
                  // cout<<sum<<endl;
                  printf("%.2f",sum/n);
              }
              
              • 0
                @ 2023-12-1 18:04:11

                hao

                • 0
                  @ 2023-3-31 20:34:00

                  #include<bits/stdc++.h> using namespace std; int main() { int n,a[101],s=0; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]; s+=a[i]; } cout<<fixed<<setprecision(2)<<(double)s1.00/n1.00; return 0; }`````

                  • 0
                    @ 2023-1-31 11:10:27
                    #include<iostream>
                    #include<iomanip>
                    using namespace std;
                    int main(){
                    	double a,b,c;
                    	cin>>a;
                    	for(int i=1;i<=a;i++)
                    	{
                    		cin>>b;
                    		c+=b;
                    	}
                    	cout<<fixed<<setprecision(2)<<c/a<<endl;
                    }
                    
                    • -1
                       include <stdio.h>
                      #include <math.h>
                      #include <iostream>
                      using namespace std;
                      int main()
                      {
                      	double n,sum = 0,x;
                      	cin >>n;
                      	for(int i = 0; i < n ; i++)
                      	{
                      		cin >> x;
                      		sum += x;
                      	}
                      	printf("%.2lf\n",sum/n);
                      }
                      
                      • -2
                        @ 2022-1-9 20:12:02
                        #include<iostream>
                        #include<iomanip>
                        #include<math.h>
                        using namespace std;
                        int main()
                        {
                            int n;  
                            cin >> n;
                            double a,b,c;
                            for (int i =1; i<=n;i++)
                            {
                                cin >>a;
                                b+=a;
                            }
                            c=b/n;
                            printf("%.2lf",c);
                        }
                        
                        • -3
                          @ 2022-1-9 20:12:02
                          #include<iostream>
                          #include<iomanip>
                          #include<math.h>
                          using namespace std;
                          int main()
                          {
                              int n;  
                              cin >> n;
                              double a,b,c;
                              for (int i =1; i<=n;i++)
                              {
                                  cin >>a;
                                  b+=a;
                              }
                              c=b/n;
                              printf("%.2lf",c);
                          }
                          
                          • -3
                            @ 2022-1-7 12:09:14
                            #include <stdio.h>
                            #include <iostream>
                            using namespace std;
                            int main()
                            {
                            	double n,sum = 0,x;
                                cin >> n;
                                for (int i = 0 ; i < n; i++)
                                {
                                    cin >> x;
                                    sum += x;
                                }
                                printf("%.2lf\n",sum/n);
                            }
                            
                            • -3
                              @ 2021-10-19 13:48:31

                              a

                              • 1

                              信息

                              ID
                              933
                              时间
                              1000ms
                              内存
                              128MiB
                              难度
                              4
                              标签
                              递交数
                              691
                              已通过
                              341
                              上传者