Advertisement
Guest User

A

a guest
May 19th, 2013
3,878
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.74 KB | None | 0 0
  1. #include <cstdio>
  2. #include <vector>
  3.  
  4. int n, cnt[5], a;
  5.  
  6. using namespace std;
  7.  
  8. int main() {
  9.     scanf("%d", &n);
  10.     for(int i = 0; i < n; i++) {
  11.         scanf("%d", &a);
  12.         if (a == 0) {
  13.             cnt[0] = 1;
  14.             continue;
  15.         }
  16.         if (a == 100) {
  17.             cnt[1] = 1;
  18.             continue;
  19.         }
  20.         if (a % 10 == 0) {
  21.             cnt[2] = a;
  22.             continue;
  23.         }
  24.         if (a < 10) {
  25.             cnt[3] = a;
  26.             continue;
  27.         }
  28.         cnt[4] = a;
  29.     }
  30.     vector < int > ans;
  31.     if (cnt[0]) ans.push_back(0);
  32.     if (cnt[1]) ans.push_back(100);
  33.     if (cnt[2]) ans.push_back(cnt[2]);
  34.     if (cnt[3]) ans.push_back(cnt[3]);
  35.     if (!cnt[2] && !cnt[3] && cnt[4]) ans.push_back(cnt[4]);
  36.     printf("%d\n", ans.size());
  37.     for(int i = 0; i < ans.size(); i++) {
  38.         if (i) printf(" ");
  39.         printf("%d", ans[i]);
  40.     }
  41.     puts("");
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement