結果
問題 |
No.297 カードの数式
|
ユーザー |
![]() |
提出日時 | 2020-02-20 21:40:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 571 bytes |
コンパイル時間 | 445 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 17,444 KB |
最終ジャッジ日時 | 2024-10-08 19:13:57 |
合計ジャッジ時間 | 3,274 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 21 |
ソースコード
from itertools import permutations def ng(f): if not f[0].isdigit():return True if not f[-1].isdigit():return True pre=True for c in f: cur=not c.isdigit() if cur and pre:return True pre=cur return False def main(): inf=10**9 n=input() cc=input().split() mx=-inf mn=inf for f in permutations(cc): if ng(f):continue f="".join(f) try: val=eval(f) except SyntaxError: continue mx=max(mx,val) mn=min(mn,val) print(mx,mn) main()