acgo题库
  • 首页
  • 题库
  • 学习
  • 竞赛
  • 讨论
  • 排行
  • 团队
  • 备赛专区

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
登录
注册
题目详情提交记录(0)
  • tijei

    #include <iostream> #include <cstdio> #include <vector> using namespace std; vector <int> bucket[65536]; int get_digit(int n, int radix){ int ct = 0; while(n){ ct++, n /= radix; } return ct; } void fsort(int *left, int *right, int radix = 65536){ int max_digit = 0; for(int *i = left; i < right; i++){ max_digit = max(max_digit, get_digit(*i, radix)); } for(int _ = 1, cur = 1; _ <= max_digit; _, cur *= radix){ for(int *i = left; i < right; i){ bucket[(*i) / cur % radix].push_back(*i); } int *ct = left; for(int i = 0; i < radix; i++){ for(auto it:bucket[i]){ *ct++ = it; } bucket[i].clear(); } } } int a[100005]; int main(){ int n; cin >> n; for(int i = 1; i <= n; i++){ cin >> a[i]; } fsort(a + 1, a + n + 1); for(int i = 1; i <= n; i++){ cout << a[i] << ' '; }

    userId_undefined

    烈火麒麟

    43阅读
    39回复
    1点赞
  • 不用自己写快排yyds

    userId_undefined

    MuktorFM

    出道萌新时间刺客时空双修者荣耀黄金CSP-S二等奖出题人
    23阅读
    2回复
    1点赞
  • 你说得对但是基数排序已纳入cjdst.h

    好用爱用

    userId_undefined

    复仇者_帅童

    小有名气CSP-J一等奖出题人
    24阅读
    0回复
    0点赞
  • 题解

    userId_undefined

    zsy

    7月全勤卷王题解仙人时间刺客时空双修者出道萌新秩序白银
    1阅读
    0回复
    1点赞
暂无数据

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

首页