Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
86898 sh25_zhoumy 直方图 C++ 通过 0 MS 288 KB 411 2026-04-10 14:41:01

Tests(1/1):


#include <iostream> #include <algorithm> using namespace std; int main() { int n, a[10005], cnt[10005] = {0}; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } int max_val = *max_element(a, a + n); for (int i = 0; i < n; i++) { cnt[a[i]]++; } for (int i = 0; i <= max_val; i++) { cout << cnt[i] << endl; } return 0; }


测评信息: