Advertisement
Guest User

Untitled

a guest
Feb 19th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. //
  2. // Created by fpdjsns
  3. // Copyright © 2019 fpdjsns. All rights reserved.
  4. //
  5.  
  6. /*
  7. * 시간복잡도 : O(N)
  8. */
  9.  
  10. #include<iostream>
  11. #include<vector>
  12. #include<algorithm>
  13.  
  14. using namespace std;
  15.  
  16. int main() {
  17. int t;
  18. cin >> t;
  19. for (int c = 1; c <= t; c++) {
  20.  
  21. int D, N, K, S;
  22. cin >> D >> N;
  23.  
  24. double maxHours = 0;
  25. for (int i = 0; i < N; i++) {
  26. cin >> K >> S;
  27. maxHours = max(maxHours, (double)(D - K) / S);
  28. }
  29.  
  30. printf("Case #%d: %lf\n", c, D / maxHours);
  31. }
  32.  
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement