結果

問題 No.689 E869120 and Constructing Array 3
ユーザー shotoyooshotoyoo
提出日時 2021-09-26 18:59:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 1,000 ms
コード長 1,110 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 75,756 KB
最終ジャッジ日時 2023-09-19 02:57:40
合計ジャッジ時間 3,876 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
71,180 KB
testcase_01 AC 78 ms
71,096 KB
testcase_02 AC 76 ms
71,092 KB
testcase_03 AC 78 ms
70,776 KB
testcase_04 AC 81 ms
74,920 KB
testcase_05 AC 80 ms
74,892 KB
testcase_06 AC 77 ms
75,040 KB
testcase_07 AC 78 ms
75,024 KB
testcase_08 AC 78 ms
74,956 KB
testcase_09 AC 77 ms
74,908 KB
testcase_10 AC 83 ms
75,756 KB
testcase_11 AC 75 ms
75,048 KB
testcase_12 AC 76 ms
74,756 KB
testcase_13 AC 73 ms
71,224 KB
testcase_14 AC 75 ms
70,776 KB
testcase_15 AC 74 ms
70,536 KB
権限があれば一括ダウンロードができます

ソースコード

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