Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.52 KB | None | 0 0
  1. void divide(int x,int dig[],bool check[],int &Max)
  2. {
  3.     while (x>0)
  4.     {
  5.         int a=x%10;
  6.         if (!check[a])
  7.         {
  8.             check[a]=true;
  9.             dig[a]++;
  10.             if (dig[a]>Max) Max=dig[a];
  11.         }
  12.         x/=10;
  13.     }
  14.     for (int i=0;i<10;i++)
  15.         if (!check[i]) dig[i]=0;
  16.         else check[i]=false;
  17. }
  18. int seq(int * tab,int n)
  19. {
  20.     int Max=0;
  21.     int dig[10]={};
  22.     bool check[10]={};
  23.     for (int i=0;i<n;i++)
  24.         divide(tab[i],dig,check,Max);
  25.     return Max;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement