結果

問題 No.864 四方演算
ユーザー ks2mks2m
提出日時 2019-08-16 21:45:08
言語 Java21
(openjdk 21)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 568 bytes
コンパイル時間 2,212 ms
コンパイル使用メモリ 74,068 KB
実行使用メモリ 57,716 KB
最終ジャッジ日時 2023-10-24 23:00:19
合計ジャッジ時間 7,324 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 AC 144 ms
57,664 KB
testcase_03 AC 146 ms
57,648 KB
testcase_04 AC 147 ms
57,520 KB
testcase_05 AC 133 ms
56,280 KB
testcase_06 AC 145 ms
57,552 KB
testcase_07 AC 145 ms
57,532 KB
testcase_08 AC 144 ms
57,716 KB
testcase_09 AC 140 ms
57,628 KB
testcase_10 AC 137 ms
57,284 KB
testcase_11 AC 138 ms
57,648 KB
testcase_12 AC 145 ms
57,208 KB
testcase_13 AC 140 ms
57,192 KB
testcase_14 AC 140 ms
57,616 KB
testcase_15 AC 150 ms
57,220 KB
testcase_16 AC 145 ms
57,288 KB
testcase_17 AC 145 ms
57,552 KB
testcase_18 AC 143 ms
57,552 KB
testcase_19 AC 140 ms
57,548 KB
testcase_20 AC 147 ms
57,408 KB
testcase_21 AC 147 ms
57,672 KB
testcase_22 AC 145 ms
57,552 KB
testcase_23 AC 143 ms
57,600 KB
testcase_24 AC 152 ms
57,636 KB
testcase_25 AC 143 ms
57,436 KB
testcase_26 AC 146 ms
57,652 KB
testcase_27 AC 131 ms
57,372 KB
testcase_28 AC 132 ms
57,472 KB
testcase_29 AC 131 ms
57,480 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