結果

問題 No.407 鴨等素数間隔列の数え上げ
ユーザー tsuchinagatsuchinaga
提出日時 2019-03-08 09:31:46
言語 Go
(1.22.1)
結果
TLE  
実行時間 -
コード長 478 bytes
コンパイル時間 12,753 ms
コンパイル使用メモリ 208,944 KB
実行使用メモリ 18,448 KB
最終ジャッジ日時 2023-09-05 19:33:49
合計ジャッジ時間 18,299 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 17 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 1 ms
4,376 KB
testcase_19 AC 75 ms
5,608 KB
testcase_20 AC 298 ms
7,780 KB
testcase_21 AC 2 ms
4,380 KB
testcase_22 AC 1 ms
4,384 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 1 ms
4,376 KB
testcase_25 AC 572 ms
8,008 KB
testcase_26 AC 1 ms
4,376 KB
testcase_27 AC 1 ms
4,380 KB
testcase_28 AC 2 ms
4,376 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 231 ms
7,784 KB
testcase_33 TLE -
testcase_34 TLE -
testcase_35 AC 503 ms
7,876 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package main

import (
	"fmt"
	"math"
)

func main() {
	var n, l int
	_, _ = fmt.Scan(&n, &l)

	cnt := 0
	p := make([]int, 0)
	for i := 2; ; i++ {
		// 素数かのチェック
		isP := true
		sq := math.Sqrt(float64(i))
		for _, a := range p {
			if float64(a) > sq {
				break
			}
			if i%a == 0 {
				isP = false
				break
			}
		}
		if !isP {
			continue
		}

		p = append(p, i)
		max := (n - 1) * i
		if max > l {
			break
		}

		cnt += l - max + 1
	}
	fmt.Println(cnt)
}
0