Blue Bridge Cup

1. Team up

As a basketball team coach, you need to select one player from position 1 to 5 from the following list to form the team's starting lineup.

The scores of each player when they occupy positions 1 to 5 are shown in the table below. What is the maximum possible sum of the scores of the starting lineup from position 1 to position 5?

Insert picture description here


2. Grid count

We use a vertex of a small square as the center of the circle to draw a circle with a radius of 1000.
Can you calculate how many complete squares there are in this circle?

Result: 3137548

public class FangGe {
	public static void main(String[] args) {
		int max=1000;
		int count=0;
		for(int i=1;i<=max;i++)
		{
			for(int j=1;j<max;j++)
			{
				if(Math.sqrt(i*i+j*j)<=max)
				{
					count++;
				}
			}
			System.out.println(4*count);
		}
	}
}

3. Test times

The inhabitants of Planet X are not very good-tempered, but fortunately, the only abnormal behavior when they are angry is: dropping the phone.
Major manufacturers have launched various drop-resistant mobile phones. X Planet ’s Quality Supervision Bureau stipulates that mobile phones must undergo a drop resistance test and a drop resistance index is assessed before they are allowed to be marketed.

Planet X has many towers towering into the clouds, which can be used for drop resistance tests. Each level of the tower is the same, and slightly different from the earth, their first floor is not the ground, but is equivalent to our second 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 after being dropped from the first layer, the drop resistance index = 0.
If you throw to the nth floor of the highest level of the tower and did not break it, 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.

The height of a test tower is 1000 floors. If we always use the best strategy, how many times do we need to test under the worst luck to determine the phone's drop resistance index?

Please fill in this maximum number of tests.

public class SPhone {
	public static void main(String[] args) {
		System.out.println(getTimes(1000, 3));
	}

	/**
	 * 获得测试次数
	 * @param m	楼层数
	 * @param n	手机数量
	 * @return times  测试次数k
	 */
	public static int getTimes(int m,int n) {
		//存放当前n部手机测试结果
		int current[] = new int[m+1];
		//存放n-1部手机的测试结果
		int pre[] = new int[m+1];
		//current初始化,同时存入一部手机的测试数据
		for(int i=0;i<m+1;i++){
			current[i] = i;
		}
		int times = 0;
		//两部及两部以上的测试情况
		for(int i=2;i<=n;i++){
			pre = current.clone();
			
			for (int k = 1; k <= m; k++) {
				current[k] = pre[k-1]+1+current[k-1];
				if (current[k] >= m) {
					//使用变量times存放k值
					times = k;
					//跳出循环块
					break;
				}
			}
		}
		return times;
	}
}


Published 44 original articles · Likes2 · Visits 540

Guess you like

Origin blog.csdn.net/qq_43699776/article/details/105294530