Promi_38

cf 1352A (old)

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