結果
問題 | No.2233 Average |
ユーザー | tenten |
提出日時 | 2023-08-09 09:19:52 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 675 ms / 2,000 ms |
コード長 | 2,017 bytes |
コンパイル時間 | 2,750 ms |
コンパイル使用メモリ | 85,316 KB |
実行使用メモリ | 61,016 KB |
最終ジャッジ日時 | 2024-04-26 23:52:43 |
合計ジャッジ時間 | 10,735 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
37,260 KB |
testcase_01 | AC | 52 ms
37,012 KB |
testcase_02 | AC | 52 ms
37,028 KB |
testcase_03 | AC | 54 ms
36,612 KB |
testcase_04 | AC | 54 ms
37,000 KB |
testcase_05 | AC | 53 ms
37,248 KB |
testcase_06 | AC | 53 ms
37,276 KB |
testcase_07 | AC | 54 ms
36,880 KB |
testcase_08 | AC | 473 ms
56,156 KB |
testcase_09 | AC | 675 ms
60,792 KB |
testcase_10 | AC | 643 ms
60,568 KB |
testcase_11 | AC | 629 ms
60,556 KB |
testcase_12 | AC | 597 ms
60,564 KB |
testcase_13 | AC | 228 ms
44,244 KB |
testcase_14 | AC | 440 ms
56,460 KB |
testcase_15 | AC | 517 ms
57,232 KB |
testcase_16 | AC | 253 ms
45,964 KB |
testcase_17 | AC | 287 ms
49,352 KB |
testcase_18 | AC | 504 ms
61,016 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); StringBuilder sb = new StringBuilder(); while (n-- > 0) { long a = sc.nextLong(); long b = sc.nextLong(); long c = sc.nextLong(); long k = sc.nextLong(); for (int i = 0; i < k && (a != b || b != c); i++) { long xa = (b + c) / 2; long xb = (c + a) / 2; long xc = (a + b) / 2; a = xa; b = xb; c = xc; } sb.append(a + b + c).append("\n"); } System.out.print(sb); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }