Promi_38

cf 1352A

Jan 11th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.46 KB | None | 0 0
  1. //better
  2.  
  3. #include<stdio.h>
  4.  
  5. int main()
  6. {
  7.     int t;
  8.     scanf("%d", &t);
  9.     while(t--)
  10.     {
  11.         int n, c = 0, cnt = 0;
  12.         scanf("%d", &n);
  13.         int num = n;
  14.         while(n != 0)
  15.         {
  16.             if(n % 10 != 0)
  17.             {
  18.                 c++;
  19.             }
  20.             n /= 10;
  21.         }
  22.         printf("%d\n", c);
  23.        
  24.         while(num != 0)
  25.         {
  26.             if(num % 10 != 0)
  27.             {
  28.                 printf("%d", num % 10);
  29.                 for(int i = 0; i < cnt; i++) printf("0");
  30.                 printf(" ");
  31.             }
  32.             cnt++;
  33.             num /= 10;
  34.         }
  35.         printf("\n");
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment