數據只有1,2,3鴨
這樣三個桶子就好了啊
while(cin>>a)
bucket[a]++;
記錄一下出現次數
再輸出按照大小(出現次數)次
for (int i = 1; i <= 3; i++)
{
for (int j = 1; j <= bucket[i]; j++)
cout << i << " ";
}
https://github.com/CalvinWan0101/ZeroJudge/blob/master/d587-%E5%8F%83%E8%B2%B3%E5%A3%B9%E7%9C%9F%E5%A5%BD%E5%90%83.cpp