acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 竞赛
  • 讨论
  • 团队
登录
注册
题目详情提交记录(0)
  • ans

    #include <bits/stdc++.h> using namespace std; using ll = long long; ll comb3(ll x){ if (x < 3) return 0; return x*(x-1)(x-2)/6; } ll comb2(ll x){ if (x < 2) return 0; return x(x-1)/2; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; if (!(cin >> n)) return 0; vector<long long> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; sort(a.begin(), a.end()) vector<pair<long long int>> vals; for (int i = 0; i < n; ){ int j = i; while (j < n && a[j] == a[i]) ++j; vals.push_back({a[i], j - i}); i = j; } }

    userId_undefined

    王驰东

    时空双修者倔强青铜
    10阅读
    0回复
    0点赞
  • bie bie

    #include <iostream> #include <vector> #include <algorithm> #include <unordered_map> using namespace std; int main() { int n; cin >> n; vector<long long> a(n); // 使用long long避免乘法溢出 for (int i = 0; i < n; ++i) { cin >> a[i]; } sort(a.begin(), a.end()); // 排序数组,便于后续处理 }

    userId_undefined

    rfhhmgftf

    时间刺客空间掌握者时空双修者I/O·IO入门者分支·分支解题者循环·循环打卡人
    1阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页