Current location - Training Enrollment Network - Mathematics courses - Mathematical program box
Mathematical program box
The output should be n+ 1.

First, the formula of sum can be calculated as S = 2 (n+ 1)- 1. When S > 20 10, the minimum n is 10.

When n=8, S=5 1 1, n=8+ 1=9, s < 20 10.

s=5 1 1+2^9= 1023,n=9+ 1= 10,s20 10,

Output n= 1 1

Of course, in order to find the answer conveniently, the value of 20 10 can be changed to 2, so when n= 1, S = 3 > 2, but the output is n S=3>2.

The correct program can be changed to: move n=n+ 1 to the judgment statement "IS > 2010", if it is greater than, output n, if it is less than, n=n+ 1, and repeat the loop.

The "output n" in the program block diagram should be changed to "output n- 1"

Your idea is very good, completely correct and simpler than mine!