結果

問題 No.864 四方演算
ユーザー ks2mks2m
提出日時 2019-08-16 21:45:08
言語 Java17
(openjdk 17.0.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 568 bytes
コンパイル時間 1,713 ms
使用メモリ 49,016 KB
最終ジャッジ日時 2022-11-23 13:23:09
合計ジャッジ時間 6,738 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 117 ms
42,596 KB
testcase_03 AC 125 ms
42,840 KB
testcase_04 AC 119 ms
42,932 KB
testcase_05 AC 117 ms
42,744 KB
testcase_06 AC 119 ms
42,908 KB
testcase_07 AC 120 ms
42,552 KB
testcase_08 AC 122 ms
42,476 KB
testcase_09 AC 112 ms
42,988 KB
testcase_10 AC 114 ms
40,852 KB
testcase_11 AC 107 ms
42,416 KB
testcase_12 AC 120 ms
42,912 KB
testcase_13 AC 108 ms
42,300 KB
testcase_14 AC 104 ms
42,060 KB
testcase_15 AC 119 ms
42,908 KB
testcase_16 AC 116 ms
42,500 KB
testcase_17 AC 120 ms
43,040 KB
testcase_18 AC 129 ms
42,740 KB
testcase_19 AC 115 ms
42,676 KB
testcase_20 AC 119 ms
42,732 KB
testcase_21 AC 114 ms
42,664 KB
testcase_22 AC 113 ms
42,448 KB
testcase_23 AC 101 ms
42,352 KB
testcase_24 AC 111 ms
42,788 KB
testcase_25 AC 113 ms
42,852 KB
testcase_26 AC 119 ms
42,708 KB
testcase_27 AC 100 ms
42,896 KB
testcase_28 AC 102 ms
40,884 KB
testcase_29 AC 96 ms
42,724 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long k = sc.nextLong();
		sc.close();

		long ans = 0;
		long end = (long) Math.sqrt(k);
		for (int i = 2; i <= end; i++) {
			if (k % i == 0) {
				long m1 = Math.min(i - 1, n);
				long v1 = Math.max(m1 - (i - 1 - m1), 0);

				long i2 = k / i;
				long m2 = Math.min(i2 - 1, n);
				long v2 = Math.max(m2 - (i2 - 1 - m2), 0);

				ans += v1 * v2;
			}
		}
		System.out.println(ans * 2);
	}
}
0