fork download
  1. #include <stdio.h>
  2. int main(void) {
  3. double time[]= {
  4. 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9,
  5. 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9,
  6. 2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8, 2.9,
  7. 3.0, 3.1, 3.2, 3.3, 3.4, 3.5, 3.6, 3.7, 3.8, 3.9,
  8. 4.0, 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7, 4.8, 4.9
  9. };
  10. double figure[]={
  11. 2.353917, 2.359012, 2.359012, 2.353917, 2.351370,
  12. 2.366655, 2.366655, 2.359012, 2.366655, 2.364107,
  13. 2.366655, 2.364107, 2.359012, 2.356465, 2.351370,
  14. 2.359012, 2.356465, 2.356465, 2.364107, 2.348822,
  15. 2.356465, 2.356465, 2.346275, 2.348822, 2.343727,
  16. 2.353917, 2.353917, 2.356465, 2.353917, 2.356465,
  17. 2.361560, 2.359012, 2.364107, 2.351370, 2.369202,
  18. 2.473652, 2.888901, 3.334720, 3.566546, 3.665901,
  19. 3.660805, 3.696471, 3.686281, 3.579284, 3.281222,
  20. 2.720763, 2.471104, 2.420153, 2.412511, 2.404868
  21. };
  22. int n=50;
  23. int max=0;
  24. for(int i=1;i<n;i++){
  25. if (figure[i]>figure[max]){
  26. max=i;
  27. }
  28. }
  29. printf("ピーク時の\n");
  30. printf("時間 : %.1f 秒\n", time[max]);
  31. printf("電位 : %.6f V\n", figure[max]);
  32. return 0;
  33. }
  34.  
  35.  
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
ピーク時の
時間  : 4.1 秒
電位  : 3.696471 V