Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <assert.h>
- #define MAXN 100000
- int zeri(int N, char S[])
- {
- long long j = 0, n;
- long long A = 1;
- for(int i=0, k=0; i<=N; i++)
- {
- char numero[N];
- if(S[i] != 'x' && i != N)
- {
- numero[k] = S[i];
- k++;
- }
- else
- {
- A *= atoi(numero);
- k=0;
- for(int c=0; c<N; c++) numero[c] = {0};
- }
- }
- while(A > 0)
- {
- n = A % 10;
- if(n != 0) break;
- else j++;
- A /= 10;
- }
- return j;
- }
- int main() {
- FILE *fr, *fw;
- char S[MAXN + 1];
- fr = fopen("input.txt", "r");
- fw = fopen("output.txt", "w");
- fscanf(fr, "%s", S);
- fprintf(fw, "%d\n", zeri(strlen(S), S));
- fclose(fr);
- fclose(fw);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment