結果
| 問題 |
No.297 カードの数式
|
| コンテスト | |
| ユーザー |
mkawa2
|
| 提出日時 | 2019-12-25 21:47:23 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,079 bytes |
| コンパイル時間 | 85 ms |
| コンパイル使用メモリ | 12,800 KB |
| 実行使用メモリ | 51,240 KB |
| 最終ジャッジ日時 | 2024-10-01 06:47:29 |
| 合計ジャッジ時間 | 9,954 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 8 RE * 1 TLE * 1 -- * 13 |
ソースコード
from itertools import *
from bisect import *
from math import *
from collections import *
from heapq import *
from random import *
import numpy as np
import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MF(): return map(float, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LF(): return list(map(float, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def main():
def ng(pc):
pm=["+","-"]
if pc[0] in pm or pc[-1] in pm:
return True
for c0,c1 in zip(pc,pc[1:]):
if c0 in pm and c1 in pm:
return True
return False
inf=10**16
n=II()
cc=input().split()
mn=inf
mx=-inf
for pc in permutations(cc):
if ng(pc):continue
val=eval("".join(pc))
if val<mn:mn=val
if val>mx:mx=val
print(mx,mn)
main()
mkawa2