結果
| 問題 |
No.3165 [Cherry 7th Tune A] Croissants Continu
|
| コンテスト | |
| ユーザー |
テナガザル
|
| 提出日時 | 2025-05-30 21:36:07 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 227 ms / 2,000 ms |
| コード長 | 407 bytes |
| コンパイル時間 | 1,012 ms |
| コンパイル使用メモリ | 99,732 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2025-05-30 21:36:13 |
| 合計ジャッジ時間 | 5,899 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
long long sum = 0, ma = 0;
for (int i = 0; i < n; ++i)
{
long long a;
cin >> a;
ma = max(ma, a);
sum += a;
}
long long ans = sum - ma + min(sum - ma + 1, ma);
cout << ans << endl;
}
}
テナガザル