結果

問題 No.80 四角形を描こう
ユーザー Tsukasa_Type
提出日時 2018-02-15 17:51:04
言語 Java
(openjdk 23)
結果
AC  
実行時間 140 ms / 5,000 ms
コード長 414 bytes
コンパイル時間 3,429 ms
コンパイル使用メモリ 73,908 KB
実行使用メモリ 41,428 KB
最終ジャッジ日時 2024-12-26 07:30:36
合計ジャッジ時間 5,851 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 8
権限があれば一括ダウンロードができます

ソースコード

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