結果

問題 No.843 Triple Primes
ユーザー 6soukiti296soukiti29
提出日時 2019-06-28 21:56:56
言語 Nim
(2.0.2)
結果
AC  
実行時間 33 ms / 2,000 ms
コード長 454 bytes
コンパイル時間 3,180 ms
コンパイル使用メモリ 68,584 KB
実行使用メモリ 4,724 KB
最終ジャッジ日時 2023-09-14 21:56:30
合計ジャッジ時間 5,220 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 33 ms
4,724 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 26 ms
4,620 KB
testcase_08 AC 29 ms
4,484 KB
testcase_09 AC 33 ms
4,540 KB
testcase_10 AC 27 ms
4,532 KB
testcase_11 AC 31 ms
4,532 KB
testcase_12 AC 33 ms
4,516 KB
testcase_13 AC 32 ms
4,588 KB
testcase_14 AC 32 ms
4,572 KB
testcase_15 AC 26 ms
4,488 KB
testcase_16 AC 27 ms
4,504 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 8 ms
4,376 KB
testcase_21 AC 4 ms
4,376 KB
testcase_22 AC 17 ms
4,380 KB
testcase_23 AC 17 ms
4,380 KB
testcase_24 AC 8 ms
4,376 KB
testcase_25 AC 6 ms
4,376 KB
testcase_26 AC 33 ms
4,576 KB
testcase_27 AC 3 ms
4,380 KB
testcase_28 AC 32 ms
4,524 KB
testcase_29 AC 9 ms
4,380 KB
testcase_30 AC 33 ms
4,652 KB
testcase_31 AC 3 ms
4,376 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 9 ms
4,380 KB
testcase_34 AC 15 ms
4,376 KB
testcase_35 AC 33 ms
4,708 KB
testcase_36 AC 6 ms
4,376 KB
testcase_37 AC 25 ms
4,376 KB
testcase_38 AC 20 ms
4,376 KB
testcase_39 AC 32 ms
4,576 KB
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 1 ms
4,380 KB
testcase_42 AC 29 ms
4,536 KB
testcase_43 AC 30 ms
4,624 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport]

ソースコード

diff #

import sequtils,strutils
var
    N = stdin.readline.parseInt
    A : array[500010, bool]
    sosu = newSeq[int](0)
    ans = 0
for i in 2..N:
    if A[i] == false:
        sosu.add(i)
        var j = i * 2
        while j <= N:
            A[j] = true
            j += i

for p in sosu:
    for r in sosu:
        if r * r > 2 * N:
            break
        var q = r * r - p
        if q > 1 and q <= N and A[q] == false:
            ans += 1

echo ans
0