Guest User

Ois_Zeri

a guest
Jun 7th, 2017
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.87 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <assert.h>
  5.  
  6. #define MAXN 100000
  7.  
  8. int zeri(int N, char S[])
  9. {
  10.     long long j = 0, n;
  11.     long long A = 1;
  12.     for(int i=0, k=0; i<=N; i++)
  13.     {
  14.         char numero[N];
  15.         if(S[i] != 'x' && i != N)
  16.         {
  17.             numero[k] = S[i];
  18.             k++;
  19.         }
  20.         else
  21.         {
  22.             A *= atoi(numero);
  23.             k=0;
  24.             for(int c=0; c<N; c++) numero[c] = {0};
  25.         }
  26.     }
  27.     while(A > 0)
  28.     {
  29.         n = A % 10;
  30.         if(n != 0) break;
  31.         else j++;
  32.         A /= 10;
  33.     }
  34.     return j;
  35. }
  36.  
  37. int main() {
  38.     FILE *fr, *fw;
  39.     char S[MAXN + 1];
  40.     fr = fopen("input.txt", "r");
  41.     fw = fopen("output.txt", "w");
  42.     fscanf(fr, "%s", S);
  43.     fprintf(fw, "%d\n", zeri(strlen(S), S));
  44.     fclose(fr);
  45.     fclose(fw);
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment