結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 RE -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 RE -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 RE -
testcase_27 WA -
testcase_28 RE -
testcase_29 WA -
testcase_30 RE -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 RE -
testcase_35 RE -
testcase_36 WA -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 AC 2 ms
4,376 KB
testcase_41 AC 2 ms
4,376 KB
testcase_42 RE -
testcase_43 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
/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 A[q] == false:
            ans += 1

echo ans



0