fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int count=0;//データの個数を格納
  5. scanf("%d",&count);
  6. double data[count];//データの格納
  7. double normal;//変化のない時の値をここに送ってもらう
  8. double tmp=0;//変化している状態の最大値を格納
  9. scanf("%lf",&normal);
  10. for(int i=0;i<count;i++){
  11. scanf("%lf",&data[i]);
  12. }
  13.  
  14. for(int i=0;i<count;i++){
  15. if(data[i]>=normal+0.2)//+0.2までは変化が乏しいとして反応させない。
  16. {
  17. if(data[i]>=tmp){
  18. tmp=data[i];
  19. }
  20. }else if(tmp>0){
  21. printf("%lf\n",tmp);
  22. tmp=0.0;
  23. }
  24. }
  25. if(tmp>0){
  26. printf("%lf\n",tmp);
  27. tmp=0.0;
  28. }
  29. return 0;
  30. }
  31.  
Success #stdin #stdout 0s 5316KB
stdin
9
2.50
 2.51 2.53 2.80 3.41 4.42 3.56 2.71 2.50 4.51 2.47
stdout
4.420000
4.510000