結果

問題 No.689 E869120 and Constructing Array 3
ユーザー hedwig100hedwig100
提出日時 2020-05-06 23:28:24
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 563 bytes
コンパイル時間 125 ms
コンパイル使用メモリ 10,760 KB
実行使用メモリ 7,960 KB
最終ジャッジ日時 2023-09-16 07:37:34
合計ジャッジ時間 2,521 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,900 KB
testcase_01 AC 17 ms
7,860 KB
testcase_02 AC 15 ms
7,864 KB
testcase_03 WA -
testcase_04 AC 16 ms
7,860 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 19 ms
7,816 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 19 ms
7,860 KB
testcase_11 WA -
testcase_12 AC 23 ms
7,816 KB
testcase_13 AC 15 ms
7,752 KB
testcase_14 AC 15 ms
7,872 KB
testcase_15 AC 15 ms
7,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10 ** 9 + 7

def main():
    K = int(input())

    fact = [1]
    for i in range(1,300):
        fact.append(fact[-1]*i)
    nck = lambda n,k:fact[n]//fact[n - k]//fact[k]
    
    N = 0
    one = 0
    flag = False
    for i in range(1,250):
        for j in range(250 - i):
            if nck(i,2) + i*j == K:
                N = i + j
                one = i
                flag = True
                break
        if flag:
            break
    
    print(N)
    ans = [1] * one + [2] * (N - one)
    print(*ans)
if __name__ == '__main__':
    main()
0