Advertisement
Guest User

Untitled

a guest
Nov 20th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.49 KB | None | 0 0
  1. #include <cstdio>
  2.  
  3. int samples[10005], n, results[10005], ans=0;
  4.  
  5. int main()
  6. {
  7.     freopen("seti.in","r",stdin);
  8.     freopen("seti.out","w",stdout);
  9.     scanf("%d",&n);
  10.     for (int i=0; i<n; i++) scanf("%d",&sample[i]);
  11.    
  12.     for (int pos=0; pos<n; pos++)
  13.         for (int i=1; pos-i>=0 && pos+i<n; i++)
  14.             if (samples[pos-i]==samples[pos+i] && samples[pos-i]<samples[i]/2.0)
  15.             {
  16.                 results[ans] = pos;
  17.                 ans++;
  18.             }
  19.            
  20.     printf("%d\n",ans);
  21.     for (int i=0; i<results; i++) printf("%d\n",results[i]);
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement