結果

問題 No.297 カードの数式
ユーザー fmhrfmhr
提出日時 2015-11-06 23:07:59
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 352 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,628 KB
実行使用メモリ 18,956 KB
最終ジャッジ日時 2023-10-11 14:51:33
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,188 KB
testcase_01 AC 16 ms
8,088 KB
testcase_02 AC 17 ms
8,100 KB
testcase_03 AC 23 ms
8,180 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

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