提交时间:2022-08-18 10:56:02
运行 ID: 55394
#include <bits/stdc++.h> using namespace std; int a[11],Max; int Read() { int x = 0,f = 0; char c = getchar(); for(;c < '0' || c > '9';c = getchar()) f ^= (c == '-'); for(;c >= '0' && c <= '9';c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48); return f ? -x : x; } int main() { int n = Read(),m = Read(),x; for(int i = 1;i <= n;i++) for(int j = 1;j <= m;j++) x = Read(), a[x]++, Max = max(Max,x); printf("%d\n",Max); for(int i = 1;i <= Max;i++) { int ans = a[i]; for(int j = i + 1;j <= Max;j++) ans += a[j]; printf("%d\n",ans); } return 0; }