結果
問題 | No.2233 Average |
ユーザー |
![]() |
提出日時 | 2023-03-06 17:49:07 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 1,016 ms / 2,000 ms |
コード長 | 1,609 bytes |
コンパイル時間 | 2,338 ms |
コンパイル使用メモリ | 76,656 KB |
実行使用メモリ | 63,456 KB |
最終ジャッジ日時 | 2024-09-18 01:54:08 |
合計ジャッジ時間 | 11,918 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 18 |
ソースコード
import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.util.StringTokenizer;public class Main {public static void main(String[] args) {FastReader fr = new FastReader();int t = fr.nextInt();for(int i=0;i<t;i++) {long a = fr.nextLong();long b = fr.nextLong();long c = fr.nextLong();long k = fr.nextLong();for(long j=0;j<k;j++) {long na = (b+c)/2L;long nb = (a+c)/2L;long nc = (a+b)/2L;a = na;b = nb;c = nc;if(a==b && a==c) break;}System.out.println(a+b+c);}}}class FastReader {private final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in), 0x10000);private StringTokenizer tokenizer;String next() {try{while(tokenizer==null || !tokenizer.hasMoreTokens()) {tokenizer = new StringTokenizer(reader.readLine());}}catch(IOException e){e.printStackTrace();}return tokenizer.nextToken();}int nextInt() {return Integer.parseInt(next());}long nextLong() {return Long.parseLong(next());}double nextDouble(){return Double.parseDouble(next());}char[] nextCharArray() {return next().toCharArray();}char nextSingleChar() { //一文字じゃなかったら' '(空白文字)返すchar[] c = next().toCharArray();if(c.length==1) {return c[0];}else {return ' ';}}String[] nextStringArray(int n) {String[] s = new String[n];for (int i = 0; i < n; i++) {s[i] = next();}return s;}}