結果

問題 No.80 四角形を描こう
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-15 17:51:04
言語 Java21
(openjdk 21)
結果
AC  
実行時間 129 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 2,471 ms
コンパイル使用メモリ 71,420 KB
実行使用メモリ 55,996 KB
最終ジャッジ日時 2023-08-27 02:12:41
合計ジャッジ時間 5,179 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 128 ms
55,360 KB
testcase_01 AC 126 ms
55,576 KB
testcase_02 AC 126 ms
55,996 KB
testcase_03 AC 128 ms
55,856 KB
testcase_04 AC 127 ms
55,588 KB
testcase_05 AC 127 ms
55,972 KB
testcase_06 AC 128 ms
55,764 KB
testcase_07 AC 128 ms
55,464 KB
testcase_08 AC 127 ms
55,852 KB
testcase_09 AC 127 ms
55,852 KB
testcase_10 AC 129 ms
55,728 KB
testcase_11 AC 129 ms
55,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	static Scanner sc = new Scanner(System.in);
	public static void main(String[] args) {
		int pencil = sc.nextInt();
		int w = 0;
		int h = 0;
		int area = 0;
		if (pencil < 4) {System.out.println(0);}
		else {
			int n = 0;
			while (pencil >= 2) {
				if (n%2==0) {w++;}
				else {h++;}
				pencil -= 2;
				area = w*h;
				n++;
			}
			System.out.println(area);
		}
	}
}
0