fork download
  1. import sys
  2.  
  3. #Time scale in us
  4. XU = 2.0
  5. #Voltage scale in V
  6. YU = 0.2
  7. #Resistors 2 and 3 resistances in ohms
  8. R2 = 987.2
  9. R3 = 99.91
  10. #Voltages of power and collector in V
  11. V = 11.6
  12. VC = 0.15
  13. #Frequency in kHz
  14. F = 50.0
  15.  
  16. #Scale is 20 units
  17. #In calculations XU and YU are in ns and mV for unit
  18. #Voltages are in mV and frequency is in Hz
  19. V *= 1000
  20. VC *= 1000
  21. F *= 1000
  22. XU *= 1000 / 20
  23. YU *= 1000 / 20
  24. e = 0.0
  25. for s in sys.stdin:
  26. if (s.strip() == ""): continue
  27. vlr = int(s) * YU
  28. pr = vlr * vlr / R3 / 1000
  29. ilr = (V - VC - vlr) / R2
  30. plr = ilr * vlr / 1000
  31. pl = plr - pr
  32. e += pl
  33. e *= XU / 1000000
  34. print("Input power was %.3f uW" % (F * e))
  35.  
Success #stdin #stdout 0s 23296KB
stdin
32
63
95
97
99
90
82
83
85
86
82
78
77
75
74
73
72
70
69
68
67
65
64
63
62
60
59
58
57
55
54
53
52
50
49
stdout
Input power was 438.548 uW