''' [Procedure 1] Question: How many three numbers can be composed of 1, 2, 3, and 4 numbers that are different from each other and have no repeated numbers? What is it? 1. Program Analysis: It can be filled in hundreds of digits, ten digits, and one digit is 1, 2, 3, and 4. Make up all the sorting before dropping the sorting that does not meet the conditions. 2. program source code: ''' for I in range (): for j in range (): for k in range (): if (I! = K) and (I! = J) and (j! = K): print I, j, k
''' [Procedure 2] Subject: the bonus paid by an enterprise is based on the profit. If the profit (I) is less than or equal to 0.1 million yuan, the bonus can be raised by 10%; if the profit is higher than 0.1 million yuan, if the profit is lower than 0.2 million yuan, the portion lower than 0.1 million yuan will be charged by 10%, and the portion higher than 0.1 million yuan, 7.5% for Coco; 0.2 million for 0.4 million to 0.2 million yuan; 5% for 0.4 million to 0.6 million yuan; 0.4 million for 3% to Yuan; between 0.6 million and 1 million, if the price is higher than 0.6 million yuan, the price can be increased to 1.5%. If the price is higher than 1 million yuan, the price of more than 1 million yuan is increased by 1%, and the current month's profit is input from the keyboard, how many bonuses should be paid? 1. Program Analysis: Use the number axis to divide and locate. Note that you need to define the bonus type as a growth integer. 2. program source code: '''bonus1 = 100000*0.1bonus2 = bonus1 + 100000 * percent = bonus2 + 200000*0.5bonus6 = bonus4 + 200000*0.3bonus10 = bonus6 + 400000 * 0.15i = int (raw_input ('input gain: \ n') if I <= 100000: bonus = I * 0.1 elif I <= 200000: bonus = bonus1 + (I-100000) * 0.075 elif I <= 400000: bonus = bonus2 + (I-200000) * 0.05 elif I <= 600000: bonus = bonus4 + (I-400000) * 0.03 elif I <= 1000000: bonus = bonus6 + (I-600000) * 0.015 else: bonus = bonus10 + (I-1000000) * 0.01 print 'bonus = ', bonus
''' [Program 3] Question: an integer. After it is added with 100, it is a full number of workers, and then 168 is a full number of workers. What is this number? 1. program Analysis: if the number is less than 0.1 million, add 100 to the number before the start, and then add 268 to the number before the start. If the result after the start meets the following conditions, it is the result. See the specific analysis: 2. program source code: # include "math. h "main () {long int I, x, y, z; for (I = 1; I <100000; I ++) {x = sqrt (I + 100 ); /* x is the result after 100 is added. */y = sqrt (I + 268 ); /* y is the result after 168 is added. */if (x * x = I + 100 & y * y = I + 268) /* If the square of the square root of a number is equal to this number, it indicates that this number is a full number of bytes */printf ("\ n % ld \ n", I );}} '''import mathfor I in range (10000): # convert to an integer value x = int (math. sqrt (I + 100) y = int (math. sqrt (I + 268) if (x * x = I + 100) and (y * y = I + 268): print I