fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int a[1000000];
  4. signed main(){
  5. ios_base::sync_with_stdio(false);
  6. cin.tie(0); cout.tie(0);
  7. int n;
  8. int C = 0;
  9. cin >> n;
  10. for (int i = 1; i<=n; i++){
  11. cin>> a[i];
  12. if (i>=2){
  13.  
  14. if ((long double)((a[i]+a[i-1])/2.0) > ((long double)(sqrt(a[i])*sqrt(a[i-1]))))
  15. {
  16. cout << (long double)((a[i]+a[i-1])/2.0) << " " << (long double)(sqrt(a[i])*sqrt(a[i-1]))<< endl;
  17. C++;
  18. cout << C;
  19. }
  20. }
  21. }
  22. cout << C;
  23. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Standard output is empty