秋祭 | 静岡高校工学部



卬高杯


提出詳細

提出id提出時刻ユーザー名問題言語判定状況判定実行時間
1148972023-10-24 10:59:19U_SEpython54/54AC67

# import sys
# sys.setrecursionlimit(10**7)
# input = sys.stdin.readline
# import pypyjit
# pypyjit.set_param('max_unroll_recursion=-1')
def mp():return map(int,input().split())
def lmp():return list(map(float,input().split()))
def lm1(LIST): return list(map(lambda x:x-1, LIST))
def mps(A):return [tuple(map(int, input().split())) for _ in range(A)]
def stoi(LIST):return list(map(int,LIST))
def itos(LIST):return list(map(str,LIST))
def atoi(LIST): return [ord(i)-ord("a") for i in LIST]
def Atoi(LIST): return [ord(i)-ord("A") for i in LIST]
def bitA(X,A):return X & 1<<A == 1<<A
import math
import bisect
import heapq
import time
from copy import copy as cc
from copy import deepcopy as dc
from itertools import accumulate, product
from collections import Counter, defaultdict, deque
def ceil(U,V):return (U+V-1)//V
def modf1(N,MOD):return (N-1)%MOD+1
inf = (1<<63)-1
mod = 998244353

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])
    if temp!=1:
        arr.append([temp, 1])
    if arr==[]:
        arr.append([n, 1])
    return arr

n = int(input())
a = factorization(n)
ans = []
hoka = [0,0]
for i,j in a:
    if i != 3 and i != 19:
        for k in range(j):ans.append(i)
    elif i == 3:hoka[0] += j
    elif i == 19:hoka[1] += j
if hoka[0] <= hoka[1]:
    for i in range(min(hoka)):
        ans.append(57)
    for i in range(abs(hoka[0]-hoka[1])):
        ans.append(19)
else:
    for i in range(min(hoka)):
        ans.append(57)
    for i in range(abs(hoka[0]-hoka[1])):
        ans.append(3)
ans.sort()
print(*ans)


sample1.txt AC 18
sample2.txt AC 25
sample3.txt AC 20
sample4.txt AC 19
case1.txt AC 19
case2.txt AC 25
case3.txt AC 25
case4.txt AC 24
case5.txt AC 24
case6.txt AC 18
case7.txt AC 28
case8.txt AC 28
case9.txt AC 23
case10.txt AC 30
case11.txt AC 24
case12.txt AC 25
case13.txt AC 23
case14.txt AC 19
case15.txt AC 20
case16.txt AC 20
case17.txt AC 20
case18.txt AC 19
case19.txt AC 19
case20.txt AC 25
case21.txt AC 30
case22.txt AC 29
case23.txt AC 22
case24.txt AC 19
case25.txt AC 32
case26.txt AC 38
case27.txt AC 32
case28.txt AC 26
case29.txt AC 18
case30.txt AC 28
case31.txt AC 33
case32.txt AC 28
case33.txt AC 36
case34.txt AC 34
case35.txt AC 29
case36.txt AC 29
case37.txt AC 25
case38.txt AC 30
case39.txt AC 30
case40.txt AC 20
case41.txt AC 26
case42.txt AC 28
case43.txt AC 18
case44.txt AC 28
case45.txt AC 38
case46.txt AC 39
case47.txt AC 57
case48.txt AC 67
case49.txt AC 28
case50.txt AC 24
67 AC