結果
問題 | No.864 四方演算 |
ユーザー |
![]() |
提出日時 | 2022-08-12 14:51:40 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 77 ms / 1,000 ms |
コード長 | 1,487 bytes |
コンパイル時間 | 3,067 ms |
コンパイル使用メモリ | 77,628 KB |
実行使用メモリ | 53,108 KB |
最終ジャッジ日時 | 2024-09-22 17:20:37 |
合計ジャッジ時間 | 5,678 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 53 ms
50,292 KB |
testcase_01 | AC | 77 ms
51,256 KB |
testcase_02 | AC | 73 ms
51,308 KB |
testcase_03 | AC | 72 ms
51,048 KB |
testcase_04 | AC | 72 ms
51,332 KB |
testcase_05 | AC | 71 ms
51,036 KB |
testcase_06 | AC | 71 ms
51,216 KB |
testcase_07 | AC | 75 ms
51,084 KB |
testcase_08 | AC | 71 ms
51,036 KB |
testcase_09 | AC | 69 ms
50,968 KB |
testcase_10 | AC | 69 ms
51,092 KB |
testcase_11 | AC | 61 ms
50,592 KB |
testcase_12 | AC | 72 ms
53,108 KB |
testcase_13 | AC | 71 ms
51,328 KB |
testcase_14 | AC | 64 ms
50,628 KB |
testcase_15 | AC | 77 ms
51,192 KB |
testcase_16 | AC | 74 ms
51,268 KB |
testcase_17 | AC | 72 ms
51,204 KB |
testcase_18 | AC | 74 ms
51,228 KB |
testcase_19 | AC | 71 ms
51,060 KB |
testcase_20 | AC | 76 ms
51,248 KB |
testcase_21 | AC | 75 ms
51,144 KB |
testcase_22 | AC | 71 ms
51,096 KB |
testcase_23 | AC | 56 ms
50,276 KB |
testcase_24 | AC | 72 ms
51,200 KB |
testcase_25 | AC | 69 ms
50,980 KB |
testcase_26 | AC | 73 ms
51,092 KB |
testcase_27 | AC | 53 ms
50,480 KB |
testcase_28 | AC | 54 ms
50,296 KB |
testcase_29 | AC | 55 ms
49,988 KB |
ソースコード
import java.io.*; import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); long n = sc.nextLong(); long k = sc.nextLong(); long ans = 0; for (long i = 2; i <= Math.sqrt(k); i++) { if (k % i == 0) { long count = getCount(i, n) * getCount(k / i, n); if (i * i < k) { count *= 2; } ans += count; } } System.out.println(ans); } static long getCount(long x, long max) { if (x <= max) { return x - 1; } else if (x <= max * 2) { return max - (x - max) + 1; } else { return 0; } } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }