[INFOR] 17 排序問題
題目連結:https://oj.infor.org/problems/17
counting sort.
counting sort.
#include<bits/stdc++.h> using namespace std; int n,a; int sor[109]; int main() { cin >> n; while(n--) { cin >> a; sor[a]++; } for(int i = 1; i <= 100; i++) while(sor[i] != 0) { cout << i << " "; sor[i]--; } }
留言
張貼留言