Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3.  
  4. using namespace std;
  5.  
  6. double mx[15][1005]= {0}, mn[15][1005];
  7.  
  8. int main() {
  9. int t;
  10. for (int i = 0; i < 15; ++i) {
  11. for (int j = 0; j < 1005; ++j) {
  12. mn[i][j] = 1000000000.0;
  13. }
  14. }
  15.  
  16. for (int j = 0; j <= 100; ++j) {
  17. if(j >= 60 && j <= 69){
  18. mx[1][j] = 2.0;
  19. mn[1][j] = 2.0;
  20. }
  21. if(j >= 70 && j <= 74){
  22. mx[1][j] = 2.5;
  23. mn[1][j] = 2.5;
  24. }
  25. if(j >= 75 && j <= 79){
  26. mx[1][j] = 3.0;
  27. mn[1][j] = 3.0;
  28. }
  29. if(j >= 80 && j <= 84){
  30. mx[1][j] = 3.5;
  31. mn[1][j] = 3.5;
  32. }
  33. if(j >= 85 && j <= 100){
  34. mx[1][j] = 4.0;
  35. mn[1][j] = 4.0;
  36. }
  37. }
  38. for (int i = 2; i <= 10; ++i) {
  39. for (int j = (i-1)*60; j <= (i-1)*100; ++j) {
  40. for (int k = 60; k <= 100; ++k) {
  41.  
  42. if(k >= 60 && k <= 69){
  43. mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+2.0);
  44. mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+2.0);
  45. }
  46. if(k >= 70 && k <= 74){
  47. mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+2.5);
  48. mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+2.5);
  49. }
  50. if(k >= 75 && k <= 79){
  51. mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+3.0);
  52. mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+3.0);
  53. }
  54. if(k >= 80 && k <= 84){
  55. mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+3.5);
  56. mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+3.5);
  57. }
  58. if(k >= 85 && k <= 100){
  59. mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+4.0);
  60. mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+4.0);
  61. }
  62. }
  63. }
  64. }
  65.  
  66. cin >> t;
  67. for (int i = 0; i < t; ++i) {
  68. int n, k;
  69. cin >> n >> k;
  70. cout << mn[k][n * k] / k << ' ' << mx[k][n * k] / k << endl;
  71. }
  72. /* cout << endl << endl;
  73. for (int i = 1; i <= 10; ++i) {
  74. for (int j = 1; j <= 1000; ++j) {
  75. cout<< mx[i][j] << ' ';
  76. }
  77. cout << endl;
  78. }
  79. */
  80. return 0;
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement