提交记录 2573


用户 题目 状态 得分 用时 内存 语言 代码长度
Loi_dfkdsmbd 1001. 测测你的排序 Compile Error 0 0 ns 0 KB C++ 615 B
提交时间 评测时间
2018-06-27 18:17:42 2020-07-31 21:04:20
void swap(unsigned *a, unsigned *b)
{
	unsigned t = *a; *a = *b; *b = t;
}

void sort(unsigned *a, int n)
{
	int mx = 0, sta[10], output[100000010];
	for(register int i = 0; i < n; i ++)
		mx = (mx < a[i]) ? a[i] : mx;
	for(register int x = 1; mx > 0; mx /= 10, x *= 10)
	{
		memset(sta, 0, sizeof(sta));
		for(register int i = 0; i < n; i ++)
			sta[(a[i] / x) % 10] ++;
		for(register int i = 1; i < 10; i ++)
			sta[i] += sta[i - 1];
		for(register int i = n - 1; i >= 0; i --)
			output[sta[(a[i] / x) % 10] - 1] = a[i], sta[(a[i] / x) % 10] --;
		for(register int i = 0; i < n; i ++)
			a[i] = output[i];
	}
}

CompilationN/AN/ACompile ErrorScore: N/A


Judge Duck Online | 评测鸭在线
Server Time: 2026-04-20 08:59:10 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠