Lesnic

24

Apr 6th, 2021
283
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #просто пробегаемся по последовательности и определяем длину нисходящей
  2. def check(num: int) -> int:
  3.     res = 0
  4.     last, num = num % 10, num // 10
  5.     temp = 1
  6.     while num != 0:
  7.         if num % 10 < last:
  8.             temp += 1
  9.         else:
  10.             if temp == 5:
  11.                 res += 1
  12.             temp = 1
  13.         last, num = num % 10, num // 10
  14.     return res
  15.  
  16.  
  17. f = open('text.txt', 'r')
  18. answer = 0
  19. for i in f:
  20.     answer += check(i)
  21. print(answer)
  22.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×