結果

問題 No.2233 Average
ユーザー Humming_sangoHumming_sango
提出日時 2023-03-06 17:49:07
言語 Java21
(openjdk 21)
結果
AC  
実行時間 1,096 ms / 2,000 ms
コード長 1,609 bytes
コンパイル時間 2,707 ms
コンパイル使用メモリ 78,100 KB
実行使用メモリ 77,792 KB
最終ジャッジ日時 2023-10-18 05:14:08
合計ジャッジ時間 12,848 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 57 ms
53,536 KB
testcase_01 AC 56 ms
52,472 KB
testcase_02 AC 57 ms
53,516 KB
testcase_03 AC 58 ms
53,528 KB
testcase_04 AC 59 ms
52,428 KB
testcase_05 AC 58 ms
53,544 KB
testcase_06 AC 59 ms
53,524 KB
testcase_07 AC 66 ms
53,540 KB
testcase_08 AC 799 ms
75,080 KB
testcase_09 AC 946 ms
75,268 KB
testcase_10 AC 861 ms
76,968 KB
testcase_11 AC 844 ms
77,488 KB
testcase_12 AC 752 ms
74,944 KB
testcase_13 AC 312 ms
64,508 KB
testcase_14 AC 714 ms
72,156 KB
testcase_15 AC 865 ms
76,044 KB
testcase_16 AC 381 ms
63,336 KB
testcase_17 AC 438 ms
68,144 KB
testcase_18 AC 1,096 ms
77,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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;
	    }

}
0