結果

問題 No.1351 Sum of GCD Equals LCM
ユーザー lam6er
提出日時 2025-03-26 15:59:18
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,281 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 82,400 KB
実行使用メモリ 52,224 KB
最終ジャッジ日時 2025-03-26 16:00:31
合計ジャッジ時間 9,574 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 2 WA * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
if n == 3:
    print("6 2 3")
elif 4 <= n <= 6:
    elements = [12]
    for i in range(2, n):
        elements.append(12 // i)
    elements += [3, 2, 1][:n - len(elements)]
    print(' '.join(map(str, elements)))
elif 7 <= n <= 8:
    elements = [24]
    for i in range(2, n):
        elements.append(24 // i)
    elements += [3, 2, 1][:n - len(elements)]
    print(' '.join(map(str, elements)))
else:
    # For larger N, adjust S and elements accordingly
    # This example uses S=60 for N up to 12
    S = 60
    elements = [S]
    for i in range(2, n):
        elements.append(S // i)
    # Fill remaining elements ensuring distinct values
    # This part is a simplified approach and may need adjustments
    next_num = S // n if S % n == 0 else 1
    while len(elements) < n:
        elements.append(next_num)
        next_num = 1  # Ensure remaining elements are distinct if possible
    # Ensure all elements are distinct and meet constraints
    # This is a heuristic and may require more sophisticated handling
    unique_elements = list(set(elements))
    if len(unique_elements) < n:
        # Adjust to ensure distinctness (this is a placeholder)
        elements = [60, 30, 20, 15, 12, 10, 6, 5, 4, 3, 2, 1][:n]
    print(' '.join(map(str, elements)))
0