标签:des style blog http color io os ar java
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 961 Accepted Submission(s): 368
#include <iostream> #include <stdio.h> #include <math.h> #include <string.h> #include <algorithm> using namespace std; int main() { int n, mm, nn; int a[101]; int ff[101]; int i, j; int ee, oo, dd; while(scanf("%d", &n)!=EOF) { if(n==1) { scanf("%d", &nn); if(nn%2==0) { printf("-1\n"); continue; } else if(nn%2==1 ) { printf("%d\n", nn); continue; } } ee=0; oo=0; dd=0; mm=999999; for(i=0; i<n; i++) { scanf("%d", &a[i] ); if(a[i]%2==1) { oo++; //奇数 if( a[i]<mm ) { mm=a[i]; } } else if(a[i]%2==0) { ee++; if(a[i]==0) dd++; //0的个数 } } if(oo==0) { printf("-1\n"); continue; } if(dd>=n-1) { printf("-1\n"); continue; } memset(ff, 0, sizeof(ff)); sort(a, a+n); for(i=0; i<n; i++) { if(a[i]==mm) { ff[i]=1; break; } } for(i=n-1; i>=0; i--) { if(ff[i]==0) printf("%d", a[i] ); } printf("%d\n", mm); } return 0; }
标签:des style blog http color io os ar java
原文地址:http://www.cnblogs.com/yspworld/p/4052585.html