Continued upward every day.

Topic introduction

3.2 Continued every day. Despite persisting every day, the development of human abilities is not unlimited, it conforms to a specific model. Assume that the capacity growth conforms to the following model with a plateau period: with a 7-day cycle, the capacity value of continuous learning for 3 days remains unchanged, and the daily capacity increase from the 4th day to the 7th day is 1% of the previous day. If there is 1 day of intermittent learning in 7 days, the period is calculated from the beginning. Please write a program to answer, if the initial (first acquaintance?) ability value is 1, what is the ability value after 365 days of continuous learning?
3.3 Continued every day. Using the ability growth model of program exercise 3.2, if the initial ability is 1, and one day off every 10 days, what is the ability value after 365 days? What if one day off every 15 days?

problem solved

#Initial capability初始能力
#isdayup 判断能力是否提升
#dayup 能力提升值
#Break interval休息间隔
Ic,isdayup,dayup,Bi=1.0,-3,0.01,10
#程序开始
for i in range(365):#365天循环开始
    if i%7==0:      #如果新的一周开始
        isdayup=-3 #初始化计算是否提升的值
    isdayup+=1     #计算能力值+1
    if i%Bi==0:    #如果到了休息时间
        i+=1        #今天休息
        isdayup=-3 #初始化计算能力值
        continue    #跳过该循环
    if isdayup>0:   #如果连续工作了到第四天以上
        Ic*=1+dayup #能力终于可以提升了
print(Ic)           #让我看看我的能力有多大

Guess you like

Origin blog.csdn.net/AQ_No_Happy/article/details/107119152