結果
問題 | No.3066 Collecting Coins Speedrun 1 |
ユーザー |
![]() |
提出日時 | 2025-03-21 21:25:41 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 554 ms / 2,000 ms |
コード長 | 390 bytes |
コンパイル時間 | 4,610 ms |
コンパイル使用メモリ | 84,568 KB |
実行使用メモリ | 61,008 KB |
最終ジャッジ日時 | 2025-03-21 21:26:00 |
合計ジャッジ時間 | 12,493 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 32 |
ソースコード
import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] c = new int[n]; for (int i = 0; i < n; i++) { c[i] = sc.nextInt(); } sc.close(); int l = Math.min(c[0], 0); int r = Math.max(c[n - 1], 0); int ans = -l * 2 + r * 2; System.out.println(ans); } }