Testing frequency

2018 Blue Bridge Cup Exam Questions

https://blog.csdn.net/qq_34202873/article/details/79784728

The inhabitants of Planet X are not very good-tempered, but fortunately, the only abnormal behavior when they are angry is to drop their mobile phones.

Major manufacturers have also launched a variety of drop-resistant mobile phones. The Quality Supervision Bureau of Planet X stipulates that the mobile phone must pass the drop test and be assessed a drop resistance index before it is allowed to be listed for circulation.

Planet X has a lot of towering towers that are just right for a drop test. Each floor of the tower is the same height, with a slight difference on Earth, their first floor is not the ground, but is equivalent to our 2nd floor.

If the phone is dropped from the 7th layer without breaking, but the 8th layer is broken, the phone's drop resistance index = 7.

In particular, if the phone is broken when dropped from the first layer, the drop resistance index = 0.

If the nth floor of the top floor of the tower is not broken, then the drop resistance index = n

In order to reduce the number of tests, 3 mobile phones were sampled from each manufacturer to participate in the test.

In one test, the tower height is 1000 layers. If we always adopt the best strategy, how many times does it take to determine the drop resistance index of the mobile phone under the worst luck?

Please fill in this maximum number of tests.

Note: What needs to be filled is an integer, do not fill in any redundant content.

#include<iostream>
using namespace std;
const int maxn = 1010;
int f[maxn][maxn];
int main(void)
{
    int n,m; // n represents the height of the building, m represents the number of mobile phones 
    cin>>n>> m;
     for ( int i= 1 ;i<=n;i++ )
         for ( int j= 1 ;j< =m;j++ )
          f[i][j]=i; 
    for(int i=2;i<=n;i++)
        for(int j=2;j<=m;j++)
            for(int k=2;k<i;k++)
                f[i][j]=min(max(f[i-k][j]+1,f[k-1][j-1]+1),f[i][j]);
    cout<<f[n][m];
    return 0;
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324886259&siteId=291194637