結果
問題 | No.407 鴨等素数間隔列の数え上げ |
ユーザー | kohaku_kohaku |
提出日時 | 2016-11-26 16:06:02 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 758 bytes |
コンパイル時間 | 2,561 ms |
コンパイル使用メモリ | 71,944 KB |
実行使用メモリ | 60,488 KB |
最終ジャッジ日時 | 2023-08-18 07:50:30 |
合計ジャッジ時間 | 9,918 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 118 ms
60,488 KB |
testcase_01 | AC | 117 ms
56,104 KB |
testcase_02 | AC | 118 ms
55,924 KB |
testcase_03 | AC | 275 ms
55,756 KB |
testcase_04 | AC | 119 ms
55,740 KB |
testcase_05 | AC | 120 ms
56,272 KB |
testcase_06 | AC | 119 ms
55,724 KB |
testcase_07 | AC | 118 ms
56,256 KB |
testcase_08 | AC | 118 ms
55,936 KB |
testcase_09 | AC | 120 ms
55,680 KB |
testcase_10 | AC | 125 ms
55,948 KB |
testcase_11 | AC | 120 ms
55,696 KB |
testcase_12 | AC | 122 ms
55,736 KB |
testcase_13 | AC | 120 ms
56,116 KB |
testcase_14 | AC | 123 ms
56,156 KB |
testcase_15 | AC | 121 ms
56,220 KB |
testcase_16 | AC | 123 ms
56,112 KB |
testcase_17 | AC | 121 ms
56,256 KB |
testcase_18 | AC | 121 ms
56,012 KB |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
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 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int L = sc.nextInt(); int dlim = L/(N-1); boolean [] d = new boolean [dlim+1]; for(int i=2; i<=dlim; i++){ d[i]=true; } for(int i=4; i<=dlim; i++){ int rt=(int)Math.sqrt(i)+1; for(int j=2; j<=rt; j++){ if(i%j==0){ d[i]=false; } } } long ans =0; for(int i=2; i<=dlim; i++){ if(d[i]==true){ long t=L-i*(N-1)+1; ans+=t; } } System.out.println(ans); } }