結果

問題 No.689 E869120 and Constructing Array 3
ユーザー shotoyoo
提出日時 2021-09-26 18:59:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 1,110 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 82,380 KB
実行使用メモリ 59,776 KB
最終ジャッジ日時 2024-07-05 15:41:28
合計ジャッジ時間 2,139 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))


k = int(input())
def main(k):
    done = 0
    for a in range(1,k+1):
        if a*a>k:
            break
        for b in range(1, k+1):
            if a+b>250 or a*b>k:
                break
            kk = k - a*b
            if kk==0:
                done = 1
                ans = [a,b,0,0]
                break
            for c in range(1, kk+1):
                if c*c>kk:
                    break
                for d in range(1, kk+1):
                    if a+b+c+d>250 or c*d>kk:
                        break
                    if c*d==kk:
                        ans = [a,b,c,d]
                        done = 1
                        break
                if done:
                    break
            if done:
                break
        if done:
            break
    return ans
ans = main(k)
print(sum(ans))
l = [2]*ans[0] + [3]*ans[1] + [6]*ans[2] + [7]*ans[3]
write(" ".join(map(str, l)))
0