結果

問題 No.2297 Best Grouping
ユーザー YGBK
提出日時 2023-05-15 18:09:59
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 2,998 ms
コンパイル使用メモリ 74,512 KB
実行使用メモリ 41,568 KB
最終ジャッジ日時 2024-11-30 23:02:42
合計ジャッジ時間 6,525 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 1 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class MyMain {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());

		if (n == 2) {
			System.out.println(1);
			sc.close();
			return;
		}

		if (n == 3) {
			System.out.println(0);
			sc.close();
			return;
		}

		System.out.println((n % 2 == 0) ? (n - 3) / 2 : (n - 3) / 2);

		sc.close();
	}

}
0