fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. double t[20000], v[20000];
  5. int n = 0, peak_count = 0;
  6.  
  7. while (scanf("%lf,%lf", &t[n], &v[n]) == 2) {
  8. n++;
  9. }
  10.  
  11. printf("波形番号\t時刻[s]\t電位[V]\n");
  12.  
  13. for (int i = 1; i < n - 1; i++) {
  14. if (v[i] > v[i - 1] && v[i] > v[i + 1] && v[i] > 3.2) {
  15. peak_count++;
  16. printf("%d\t\t%.2f\t%.3f\n", peak_count, t[i], v[i]);
  17. i += 50;
  18. }
  19. }
  20.  
  21. return 0;
  22. }
  23.  
Success #stdin #stdout 0.01s 5316KB
stdin
Standard input is empty
stdout
波形番号	時刻[s]	電位[V]