Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int n,k;
  6. int a[1001];
  7.  
  8. int main()
  9. {
  10. cin>>n>>k;
  11. for(int i=1;i<=n;++i)
  12. cin>>a[i];
  13. int start1,start2;
  14. bool eBun;
  15. for(int i=1;i<k;++i){
  16. start1=(i-1)*(n/k)+1;
  17. for (int j=i+1;j<=k;++j){
  18. start2=(j-1)*(n/k)+1;
  19. eBun=1;
  20. for(int p=0;p<n/k;++p){
  21. if(a[start1+p]!=a[start2+p]){
  22. eBun=0;
  23. break;
  24. }
  25. }
  26. if(eBun==1){
  27. cout<<i<<" "<<j;
  28. return 0;
  29. }
  30. }
  31. }
  32. cout<<"NU";
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement