結果

問題 No.172 UFOを捕まえろ
ユーザー kenkooookenkoooo
提出日時 2015-03-26 23:34:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 39 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 4,263 ms
コンパイル使用メモリ 69,584 KB
実行使用メモリ 33,256 KB
最終ジャッジ日時 2023-08-05 16:55:37
合計ジャッジ時間 6,445 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
33,148 KB
testcase_01 AC 38 ms
33,160 KB
testcase_02 AC 37 ms
32,732 KB
testcase_03 AC 38 ms
32,800 KB
testcase_04 AC 38 ms
32,920 KB
testcase_05 AC 38 ms
32,920 KB
testcase_06 AC 38 ms
32,908 KB
testcase_07 AC 38 ms
33,056 KB
testcase_08 AC 37 ms
33,208 KB
testcase_09 AC 38 ms
32,948 KB
testcase_10 AC 38 ms
32,840 KB
testcase_11 AC 38 ms
32,808 KB
testcase_12 AC 37 ms
32,872 KB
testcase_13 AC 39 ms
33,256 KB
testcase_14 AC 37 ms
32,732 KB
testcase_15 AC 37 ms
32,856 KB
testcase_16 AC 37 ms
32,936 KB
testcase_17 AC 38 ms
32,888 KB
testcase_18 AC 38 ms
33,128 KB
testcase_19 AC 37 ms
32,712 KB
testcase_20 AC 37 ms
32,760 KB
testcase_21 AC 37 ms
32,832 KB
testcase_22 AC 37 ms
32,856 KB
testcase_23 AC 37 ms
32,844 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.IOException;

public class Main {

	public static void main(String[] args) {
		int x = nextInt();
		int y = nextInt();
		int r = nextInt();
		int dist = Math.abs(x) + Math.abs(y) + (int) Math.ceil((double) Math.sqrt(2) * r);
		System.out.println(dist);
	}

	static int nextInt() {
		int c;
		try {
			c = System.in.read();
			while (c != '-' && (c < '0' || c > '9'))
				c = System.in.read();
			if (c == '-')
				return -nextInt();
			int res = 0;
			while (c >= '0' && c <= '9') {
				res = res * 10 + c - '0';
				c = System.in.read();
			}
			return res;
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return -1;
	}

}
0