Love丶FFC's Blog
1.T,E统计在输入的时候就进行
2.注意E统计的是发生掉落的苹果棵数,而不是发生掉落的次数
3.使用T来判断E的情况
4.因为使用列表,需要对E额外进行两次首尾相连的特殊情况判断。
NOT = int(input()) # 输入苹果树的棵数 Operate = list() # 存放每一行输入值的列表 Continuous = [0 for i in range(NOT)] # 存放掉落苹果情况的苹果树编号 T, D, E = 0, 0, 0 # 分别代表疏果操作结束后总的苹果个数,掉落苹果的苹果棵数,连续三棵树发生掉落苹果的情况的组数 # 完成T和D的统计 for i in range(NOT): Operate = list(map(int, input().split())) # 将输入的一行全部存入列表中 Initial = Operate[1] # 每棵苹果树记录的初始苹果个数为列表下标的第1个元素 DJudge = False # 该苹果树是否掉落 for j in range(Operate.__len__() - 2): # 对列表的最后(列表-2)个元素进行遍历 if Operate[j + 2] > 0: # 发现更新的苹果个数 if Operate[j + 2] < Initial and DJudge == False: # 该苹果树首次发生苹果掉落的情况 D += 1 DJudge = True Continuous[i] = 1 # 将该苹果树的掉落标记改为1 Initial = Operate[j + 2] # 更新记录的苹果个数 else: # 疏果个数 Initial += Operate[j + 2] T += Initial # 完成E的统计 if T < 3: # 不可能存在连续3棵掉落的情况 E = 0 else: for i in range(Continuous.__len__() - 2): # 对掉落苹果树列表进行遍历 if Continuous[i] == Continuous[i + 1] == Continuous[i + 2] == 1: E += 1 if Continuous[Continuous.__len__() - 2] == Continuous[Continuous.__len__() - 1] == Continuous[0] == 1: # 对特殊情况进行判断 E += 1 if Continuous[Continuous.__len__() - 1] == Continuous[0] == Continuous[1] == 1: # 对特殊情况进行判断 E += 1 print(T, D, E)
cheap jordan shoes
Read reviews and was a little hesitant since I had already inputted my order. or possibly but thank god, I had no issues. since the received item in a timely matter, they are in new condition. situation so happy I made the purchase. Will be definitely be purchasing again.
cheap jordan shoes https://www.retrocheapjordansshoes.com/
cheap jordans
Read reviews and was a little hesitant since I had already inputted my order. or sometimes but thank god, I had no issues. significantly received item in a timely matter, they are in new condition. anyway so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans https://www.realjordansshoes.com/
cheap jordans online
Read reviews and was a little hesitant since I had already inputted my order. also but thank god, I had no issues. including received item in a timely matter, they are in new condition. in either case so happy I made the purchase. Will be definitely be purchasing again.
cheap jordans online https://www.realjordansretro.com/
authentic louis vuitton outlet
Read reviews and was a little hesitant since I had already inputted my order. nicely but thank god, I had no issues. choose to received item in a timely matter, they are in new condition. you decide so happy I made the purchase. Will be definitely be purchasing again.
authentic louis vuitton outlet https://www.louisvuittonsoutletonline.com/
Knitant
You know it s bad news for gout viagra coupon cvs parlodel gentle laxative bisacodyl 5 mg dosage Internal company emails presented at the trial on Monday showed BP saying publicly after the spill in April 2010 that 5, 000 barrels of oil a day were leaking into the ocean when it knew up to 100, 000 barrels a day could have been leaking
invoimi
Augustine BHpJlBaviRoci 6 29 2022 buying cialis online reviews Epub 2015 Oct 17
Knwmvy
fenofibrate 200mg uk order tricor 160mg for sale order fenofibrate 160mg sale
Tinysk
cialis 20mg oral sildenafil 50mg tablets sildenafil order
Aknsym
order ketotifen generic order tofranil 25mg without prescription order tofranil 25mg generic
Rgrpeq
order minoxytop online order minoxytop solution top rated ed pills
Ekcmps
buy acarbose 50mg for sale purchase fulvicin without prescription griseofulvin drug