标签:io for on amp as return hdu class ca
#include <cstdio> int t,n,a[10]; int main(){ while(~scanf("%d",&n)){ int flag=0; for(int i=0;i<10;i++)a[i]=0; for(int i=0;i<n;i++)scanf("%d",&t),a[t]++; if(n==1){printf("%d\n",t&1?t:-1);continue;} for(int i=1;i<10;i+=2)if(a[i]){flag=1;a[i]--;t=i;break;} if(flag==0){puts("-1");continue;}flag=0; for(int i=1;i<10;i++)if(a[i]>0)flag=1; if(flag==0){puts("-1");continue;} for(int i=9;i>=0;i--)while(a[i]>0)printf("%d",i),a[i]--; printf("%d\n",t); }return 0; } //注意n==1的情况
标签:io for on amp as return hdu class ca
原文地址:http://www.cnblogs.com/forever97/p/4024506.html