結果
問題 | No.752 mod数列 |
ユーザー | htensai |
提出日時 | 2019-12-11 12:31:30 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 851 bytes |
コンパイル時間 | 2,049 ms |
コンパイル使用メモリ | 72,460 KB |
実行使用メモリ | 70,176 KB |
最終ジャッジ日時 | 2023-09-06 13:02:36 |
合計ジャッジ時間 | 11,086 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 118 ms
60,752 KB |
testcase_01 | AC | 118 ms
55,968 KB |
testcase_02 | AC | 119 ms
55,752 KB |
testcase_03 | AC | 118 ms
56,276 KB |
testcase_04 | AC | 122 ms
56,364 KB |
testcase_05 | AC | 123 ms
56,204 KB |
testcase_06 | AC | 125 ms
56,036 KB |
testcase_07 | AC | 127 ms
55,880 KB |
testcase_08 | AC | 122 ms
55,744 KB |
testcase_09 | AC | 127 ms
55,784 KB |
testcase_10 | AC | 208 ms
58,748 KB |
testcase_11 | AC | 198 ms
58,956 KB |
testcase_12 | AC | 201 ms
58,360 KB |
testcase_13 | AC | 202 ms
58,496 KB |
testcase_14 | AC | 202 ms
58,264 KB |
testcase_15 | AC | 1,023 ms
65,372 KB |
testcase_16 | TLE | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int p = sc.nextInt(); int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < q; i++) { int left = sc.nextInt(); int right = sc.nextInt(); long start = left; long total = (right - left + 1) * (long) p; while (start <= right) { long div = p / start; if (div == 0) { break; } long end = Math.min(p / div, right); total -= (end - start + 1) * (end + start) / 2 * div; start = end + 1; } sb.append(total).append("\n"); } System.out.print(sb); } }