1972021-02-06 11:40:29Molnár AttilaOszthatóság 31-gyelpython3Accepted 50/5039ms13328 KiB
from sys import stdin, stdout

s=0
r=0
l=[]

def oszt31():
  global l,s,r
  l.append(s)
  (s,r) = divmod(s,10)
  s-=3*r
  if (s<=0): # 27 = 3*9, a legnagyobb kivonható összeg
    if (s==0):
      l.append(s)
      return True
    return False
  return oszt31()

def main():
  global l,s,r
  s = int(stdin.readline())
  b = oszt31()
  stdout.write('IGEN\n' if b else 'NEM\n')

  for e in l[1:]:
    stdout.write(f'{e} ')
  if not b:
    stdout.write('\n')

main()
SubtaskSumTestVerdictTimeMemory
base50/50
1Accepted0/039ms13236 KiB
2Accepted0/028ms13188 KiB
3Accepted3/328ms13316 KiB
4Accepted3/328ms13236 KiB
5Accepted4/428ms13244 KiB
6Accepted4/429ms13328 KiB
7Accepted4/434ms13240 KiB
8Accepted4/428ms13308 KiB
9Accepted4/427ms13244 KiB
10Accepted4/439ms13280 KiB
11Accepted4/428ms13240 KiB
12Accepted4/428ms13240 KiB
13Accepted4/428ms13276 KiB
14Accepted4/428ms13232 KiB
15Accepted2/228ms13328 KiB
16Accepted2/228ms13296 KiB