結果

問題 No.297 カードの数式
ユーザー fmhr
提出日時 2015-11-06 23:07:59
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 352 bytes
コンパイル時間 372 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 23,200 KB
最終ジャッジ日時 2024-09-13 13:44:13
合計ジャッジ時間 2,776 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
c = list(map(str, input().split()))
from itertools import permutations
ans = []
for s in permutations(c, N):
	if s[0]=='+' or s[0] == '-':
		continue
	try:	
		a = str(''.join(s))
		if '++' in a or '--' in a or '+-' in a or '-+' in a:
			continue
		ans.append(eval(a))
		#print(a)
	except SyntaxError:
		pass
		
print(max(ans),min(ans))
0