fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <cmath>
  4. using namespace std;
  5. int main() {
  6. int n;
  7. cin >> n;
  8. double max = 0;
  9. for(int i = 0;i<n;i++){
  10. double a;
  11. cin>>a;
  12. if(a<0)a=fabs(a);
  13. if(a>max)max=a;
  14. }
  15. cout<<fixed<<setprecision(2)<<max;
  16. }
Success #stdin #stdout 0s 15232KB
stdin
10
-1 -2 -3 -4 -5 -6 -7 -8 -9 1
stdout
9.00