結果

問題 No.172 UFOを捕まえろ
ユーザー kenkooookenkoooo
提出日時 2015-03-26 23:34:49
言語 Java
(openjdk 23)
結果
AC  
実行時間 53 ms / 5,000 ms
コード長 686 bytes
コンパイル時間 2,002 ms
コンパイル使用メモリ 74,656 KB
実行使用メモリ 36,856 KB
最終ジャッジ日時 2024-10-15 13:59:41
合計ジャッジ時間 4,107 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

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