首页 >

左侧严格小于计数

n = int(input())
a = list(map(int,input().split()))
b = []

for i in range(n):
    c=0 #需要将c在这里重置,否则会一直加上之前计数的个数
    for j in range(i):
        if (a[j] < a[i] and j < i):
            c += 1
    b.append(c)
    

for i in b:
    print(i,end=' ')


n = int(input())
a = list(map(int,input().split()))
b = []

for i in range(n):
    c=0 #需要将c在这里重置,否则会一直加上之前计数的个数
    for j in range(i):
        if (a[j] < a[i] and j < i):
            c += 1
    b.append(c)
    

for i in b:
    print(i,end=' ')


发表于 2025-07-02 17:28:31 回复(0)
n=int(input())
a=list(map(int,input().split()))

res=[0]
for i in range(1,n):
    temp=a[i]
    count=0
    for j in range(i):
        if a[j]<temp:
            count=count+1
        else:
            continue
    res.append(count)

for item in res:
    print(item,end=" ")

发表于 2025-06-28 22:07:00 回复(0)
import sys

i = 0
j = 0
count = 0
b = []
num = map(int,input().split(" "))
for line in sys.stdin:
    a = line.split()
    for i in range(0,len(a)):
        while j < i:
            if int(a[i]) > int(a[j]):
                count += 1
            j += 1
        b.append(str(count))
        count = 0
        j = 0
        i+=1
   
    print(" ".join(b))
发表于 2025-06-26 19:19:43 回复(0)
n=int(input())
a=list(map(int,input().split()))
d=[]
for i in range(n):
    c=0
    for j in range(i):
        if a[i]>a[j]:
            c+=1
    d.append(str(c))
print(' '.join(d))  
发表于 2025-06-23 17:28:02 回复(0)
n = int(input())
a = list(map(int, input().strip().split()))
b = [0]
for i in range(1, n):
    temp = sorted(a[:i+1:1])
    b.append(temp.index(a[i]))
print(*b)
发表于 2025-06-17 23:31:48 回复(0)
import sys

n = int(input())  # 读取序列长度
a = list(map(int, input().split()))  # 读取序列

b = []  # 初始化结果序列
for i in range(n):
    count = 0  # 初始化计数器
    for j in range(i):
        if a[j] < a[i]:
            count += 1  # 如果前面的元素小于当前元素,计数器加1
    b.append(count)  # 将当前元素的计数结果追加到结果序列中

print(' '.join(map(str, b)))  # 输出结果序列

发表于 2025-06-07 19:59:04 回复(0)
import java.util.*;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> list = new ArrayList();
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int a = in.nextInt();
            list.add(a);
            int q = 0;
            for(int i:list){
                if(a>i) q++; 
            }
            System.out.print(q+" ");   
        }
    }
}

发表于 2025-06-05 16:41:06 回复(0)
n = int(input())
n1 = list(map(int,input().split()))
n2 = []
n3 = []
for i in n1:
    i1 = len([i2 for i2 in n2 if i2 < i])
    n3.append(i1)
    n2.append(i)
print(' '.join(map(str,n3)))
发表于 2025-06-03 10:39:14 回复(0)