結果

問題 No.796 well known
ユーザー foumi
提出日時 2019-04-06 17:23:28
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 508 bytes
コンパイル時間 327 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 19,008 KB
最終ジャッジ日時 2024-06-24 09:02:15
合計ジャッジ時間 4,475 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 2 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

import random
from functools import reduce
from operator import mul
N = int(input())
l = []
limit = 312456 - N + 1

def random_list():
    for i in range(N):
        l.append(random.randint(0, (limit) - sum(l)))

for x in range(limit**N):
    random_list()
    if 0 in l:
        l = []
        continue
    elif sum(l) % 3 != 1:
        l = []
        continue
    elif reduce(mul, l) % 3 == 0:
        l = list(map(str, l))
        print(' '.join(l))
        break
    else:
        l = []
        continue
0