2009年6月25日 星期四

ACM Q11462



#include <iostream>

using namespace std;

int main(){
int ints[100];
while(true){
int count =0;
int count2 =0;
for(int i=0; i< 100; i++){
ints[i]=0;
}
int items;
cin >> items;
if(items==0)
break;
for(int i=0; i< items; i++){
int tmp;
cin >> tmp;
if(ints[tmp-1]==0)
count++;
ints[tmp-1]++;
}

for(int i=0; i< 100; i++){
if(ints[i]>0)
count2++;
for(int j=0; j< ints[i]; j++){
if(count2==count && j==ints[i]-1)
cout<<(i+1)<<endl;
else
cout<<(i+1)<<" ";
}
}
}
return 0;
}

沒有留言:

張貼留言