結果

問題 No.3165 [Cherry 7th Tune A] Croissants Continu
ユーザー titia
提出日時 2025-06-04 02:32:51
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 349 ms / 2,000 ms
コード長 318 bytes
コンパイル時間 366 ms
コンパイル使用メモリ 12,032 KB
実行使用メモリ 42,960 KB
最終ジャッジ日時 2025-06-04 02:32:59
合計ジャッジ時間 7,556 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

T=int(input())
for tests in range(T):
    N=int(input())
    A=list(map(int,input().split()))

    if N==1:
        print(1)
        continue

    A.sort()
    SUM=sum(A)

    if A[-1]<=(SUM-A[-1]+1):
        print(SUM)
    else:
        A[-1]=SUM-A[-1]+1

        print(sum(A))
0