Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double mx[15][1005]= {0}, mn[15][1005];
- int main() {
- int t;
- for (int i = 0; i < 15; ++i) {
- for (int j = 0; j < 1005; ++j) {
- mn[i][j] = 1000000000.0;
- }
- }
- for (int j = 0; j <= 100; ++j) {
- if(j >= 60 && j <= 69){
- mx[1][j] = 2.0;
- mn[1][j] = 2.0;
- }
- if(j >= 70 && j <= 74){
- mx[1][j] = 2.5;
- mn[1][j] = 2.5;
- }
- if(j >= 75 && j <= 79){
- mx[1][j] = 3.0;
- mn[1][j] = 3.0;
- }
- if(j >= 80 && j <= 84){
- mx[1][j] = 3.5;
- mn[1][j] = 3.5;
- }
- if(j >= 85 && j <= 100){
- mx[1][j] = 4.0;
- mn[1][j] = 4.0;
- }
- }
- for (int i = 2; i <= 10; ++i) {
- for (int j = (i-1)*60; j <= (i-1)*100; ++j) {
- for (int k = 60; k <= 100; ++k) {
- if(k >= 60 && k <= 69){
- mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+2.0);
- mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+2.0);
- }
- if(k >= 70 && k <= 74){
- mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+2.5);
- mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+2.5);
- }
- if(k >= 75 && k <= 79){
- mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+3.0);
- mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+3.0);
- }
- if(k >= 80 && k <= 84){
- mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+3.5);
- mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+3.5);
- }
- if(k >= 85 && k <= 100){
- mn[i][j+k] = min(mn[i][k+j], mn[i-1][j]+4.0);
- mx[i][j+k] = max(mx[i][k+j], mx[i-1][j]+4.0);
- }
- }
- }
- }
- cin >> t;
- for (int i = 0; i < t; ++i) {
- int n, k;
- cin >> n >> k;
- cout << mn[k][n * k] / k << ' ' << mx[k][n * k] / k << endl;
- }
- /* cout << endl << endl;
- for (int i = 1; i <= 10; ++i) {
- for (int j = 1; j <= 1000; ++j) {
- cout<< mx[i][j] << ' ';
- }
- cout << endl;
- }
- */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement