#13755: answer


alexrobotvm0@gmail.com (黃子軒)

School : 國立內壢高級中學
ID : 70522
IP address : [42.73.177.246]
Last Login :
2021-07-29 14:49:35
d587. 參貳壹真好吃 -- jack1 | From: [220.135.132.11] | Post Date : 2018-04-21 11:33

以下是解法

 

#include <stdio.h>

int main() {
int count[4] = {0};
long long num = 0;
int tmp = 0;

scanf("%lld", &num);

for (int i = 0; i < num; i++) {
scanf("%d", &tmp);

if (tmp == 1)
count[1]++;
else if (tmp - 2)
count[3]++;
else
count[2]++;
}

for (int i = 1; i <= 3; i++)
for (int j = 0; j < count[i]; j++) {
printf("%d ", i);
}

return 0;
}

 
ZeroJudge Forum