結果

問題 No.80 四角形を描こう
ユーザー spaciaspacia
提出日時 2016-01-09 09:33:38
言語 Java21
(openjdk 21)
結果
AC  
実行時間 54 ms / 5,000 ms
コード長 502 bytes
コンパイル時間 2,122 ms
コンパイル使用メモリ 74,164 KB
実行使用メモリ 37,020 KB
最終ジャッジ日時 2024-04-16 22:52:16
合計ジャッジ時間 3,385 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
36,880 KB
testcase_01 AC 54 ms
36,876 KB
testcase_02 AC 52 ms
36,772 KB
testcase_03 AC 54 ms
36,924 KB
testcase_04 AC 52 ms
36,396 KB
testcase_05 AC 52 ms
36,960 KB
testcase_06 AC 53 ms
36,956 KB
testcase_07 AC 51 ms
36,396 KB
testcase_08 AC 52 ms
36,428 KB
testcase_09 AC 52 ms
36,580 KB
testcase_10 AC 54 ms
36,924 KB
testcase_11 AC 54 ms
37,020 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;

class Main {
	
	public static void out (Object o) {
		System.out.println(o);
	}
	
	public static int solve (int d) {
		if (d < 4) return 0;
		if (d % 2 == 1) d--;
		
		d /= 2;
		boolean b = d % 2 == 0;
		d /= 2;
		return b ? d * d : d * (d + 1);
	}
	
	public static void main (String[] args) throws IOException {
		BufferedReader br = 
			new BufferedReader(new InputStreamReader(System.in));
		
		int d = Integer.parseInt(br.readLine());
		
		out(solve(d));
	}
}
0