結果

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

テストケース

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

ソースコード

diff #

MOD = 10 ** 9 + 7

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

    fact = [1]
    for i in range(1,200):
        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