結果
問題 |
No.689 E869120 and Constructing Array 3
|
ユーザー |
![]() |
提出日時 | 2020-12-09 23:58:47 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 29 ms / 1,000 ms |
コード長 | 1,005 bytes |
コンパイル時間 | 242 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,008 KB |
最終ジャッジ日時 | 2024-09-19 06:28:12 |
合計ジャッジ時間 | 1,918 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 |
ソースコード
def main(K): if K == 0: print(1, 10, sep="\n") return elif K == 1: print(2, *[1, 1], sep="\n") return ok = False for i in range(1, int(K ** 0.5 + 0.5) + 1): if K % i == 0 and (i + K // i) <= 250: ok = True two, three = i, K // i break if ok: print(two + three) A = [3] * two + [8] * three print(*A) return one = 2 while True: x = one * (one - 1) // 2 ok = False if x > K: break tmp = K - x for i in range(1, int(tmp ** 0.5 + 0.5) + 1): if tmp % i == 0 and (one + i + tmp // i) <= 250: ok = True two, three = i, K // i break if ok: break one += 1 if ok: print(one + two + three) A = [1] * one + [3] * two + [8] * three print(*A) return print(None) return K = int(input()) main(K)