Advertisement
umc19844

Untitled

Jan 23rd, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.76 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.         int i;
  6.         char arr[] = {12, 2, 5, 9, 10, 0, 11, 1, 3, 4, 0, 13, 6, 7, 8};
  7.         int Sindex[10][2] = {0};
  8.         int now = 0;
  9.  
  10.         //////////////////////////////////////////////////////////////
  11.         for( i = 0; i < sizeof(arr); i++ ) {
  12.                 if( arr[i] == 0 ) {
  13.                         now++;
  14.                         continue;
  15.                 }
  16.  
  17.                 if( Sindex[now][1] == 0 )
  18.                         Sindex[now][0] = i;
  19.  
  20.                 Sindex[now][1]++;
  21.         }
  22.         //////////////////////////////////////////////////////////////
  23.  
  24.  
  25.         for( i = 0; i < now+1; i++ ) {
  26.                 printf("%d %d\n", Sindex[i][0], Sindex[i][1]);
  27.         }
  28.  
  29.         return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement