3 条题解

  • 2
    @ 2022-6-5 10:12:59
    #include<iostream>
    #include<cmath>
    #include<bits/stdc++.h>
    using namespace std;
    int q,w,e,r,t,y,u,i,o,p,s,d,f,g,h,j,z,x,v,n,m,c;
    int a[1000000],b[1000000];
    double k,l;
    int main()
    {
        cin>>n;
        for(i=1;i<=n;i++)
        {
            cin>>a[i];
        }
        k=0;
        for(i=1;i<=n;i++)
        {
            s=0;
            for(j=1;j<=i;j++)
            {
                if(a[i]>a[j])
                {
                    s++;
                }
            }
            cout<<s<<" ";
        }
        return 0;
    }
    
    • 1
      @ 2022-5-18 22:07:55

      `

      #include <bits/stdc++.h>
      using namespace std;
      int main()
      {
          int n, i, j, s;    
          cin >> n;
          int a [n];
          for (i = 0; i < n; i ++) {                            
              s = 0;
              cin >> a [i];
              for (j = i; j >= 0; j --) {
                  if (a [i] > a [j]) s ++;
              }
              cout << s << " ";  
          }
          return 0;
      }
      
      • 0
        @ 2022-11-19 11:11:18
        #include <iostream>
        using namespace std;
        int main(){
            int a[150],n,s=0;
            cin>>n;
            for(int i=0;i<n;i++){
                cin>>a[i];
            }
            cout<<0<<' ';
            for (int i=1;i<n;i++){
                for(int j=0;j<i;j++){
                    if(a[j]<a[i])s++;
                }
                cout<<s<<' ';
                s=0;
            }
            return 0;
        }
        
        • 1

        信息

        ID
        428
        时间
        1000ms
        内存
        128MiB
        难度
        1
        标签
        递交数
        124
        已通过
        96
        上传者