ddddd

From , 3 Years ago, written in C++, viewed 215 times.
URL https://pastebin.vip/view/f48c04ff
  1. #include<stdio.h>
  2. #include<iostream>
  3. #include<algorithm>
  4. #include<cmath>
  5. #include<cstring>
  6. #include<string.h>
  7. #include<queue>
  8. #include<stack>
  9. #include<list>
  10. #include<map>
  11. #include<set>
  12. #include<vector>
  13. using namespace std;
  14. typedef long long int ll;
  15. typedef unsigned long long ull;
  16. const int maxn =1e5+5;
  17. const int maxm=10000;
  18. const int mod =1e9+7;
  19. const int INF=0x3f3f3f3f;
  20. const double eps=1e-8;
  21. int a[maxn];
  22. int main()
  23. {
  24.     int n,k;scanf("%d%d",&n,&k);
  25.     for(int i=0;i<n;i++)scanf("%d",&a[i]);
  26.     int ans=1;int cnt=1;
  27.     for(int i=1;i<n;i++)
  28.     {
  29.         if(a[i]!=a[i-1]) cnt++;
  30.         else cnt=1;
  31.         ans=max(ans,cnt);
  32.     }
  33.     printf("%d\n",ans);
  34.     return 0;
  35. }
  36.  

Reply to "ddddd"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website