fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. double t[] = {1.88, 1.91, 1.95, 2.75, 2.79, 2.85, 3.50, 3.55, 3.60, 10.0, 15.0};
  5. double v[] = {3.45, 3.53, 3.48, 3.50, 3.58, 3.52, 3.70, 3.78, 3.72, 3.00, 3.00};
  6.  
  7. int n = 11;
  8. int count = 1;
  9.  
  10.  
  11. for (int i = 1; i < 10; i++) {
  12.  
  13. if (v[i] > v[i - 1] && v[i] >= v[i + 1]) {
  14.  
  15. if (v[i] > 3.0) {
  16. printf("%d回目:時刻=%.2f秒、電位=%.2fV\n", count, t[i], v[i]);
  17.  
  18. count = count + 1;
  19. }
  20. }
  21. }
  22.  
  23. return 0;
  24. }
Success #stdin #stdout 0s 5328KB
stdin
Standard input is empty
stdout
1回目:時刻=1.91秒、電位=3.53V
2回目:時刻=2.79秒、電位=3.58V
3回目:時刻=3.55秒、電位=3.78V