結果

問題 No.843 Triple Primes
ユーザー Mcpu3Mcpu3
提出日時 2019-06-29 04:24:23
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 425 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 68,456 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-14 22:58:17
合計ジャッジ時間 4,745 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 127 ms
4,380 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,376 KB
testcase_07 AC 93 ms
4,380 KB
testcase_08 AC 107 ms
4,376 KB
testcase_09 AC 127 ms
4,376 KB
testcase_10 AC 98 ms
4,376 KB
testcase_11 AC 114 ms
4,380 KB
testcase_12 AC 122 ms
4,380 KB
testcase_13 AC 118 ms
4,376 KB
testcase_14 AC 118 ms
4,376 KB
testcase_15 AC 95 ms
4,376 KB
testcase_16 AC 97 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 WA -
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 20 ms
4,376 KB
testcase_21 AC 10 ms
4,376 KB
testcase_22 AC 55 ms
4,376 KB
testcase_23 AC 57 ms
4,376 KB
testcase_24 AC 22 ms
4,376 KB
testcase_25 AC 15 ms
4,376 KB
testcase_26 AC 126 ms
4,376 KB
testcase_27 AC 3 ms
4,376 KB
testcase_28 AC 120 ms
4,380 KB
testcase_29 AC 24 ms
4,380 KB
testcase_30 AC 124 ms
4,380 KB
testcase_31 AC 5 ms
4,380 KB
testcase_32 AC 3 ms
4,376 KB
testcase_33 AC 28 ms
4,376 KB
testcase_34 AC 49 ms
4,376 KB
testcase_35 AC 125 ms
4,380 KB
testcase_36 AC 13 ms
4,380 KB
testcase_37 AC 89 ms
4,376 KB
testcase_38 AC 68 ms
4,376 KB
testcase_39 AC 121 ms
4,376 KB
testcase_40 WA -
testcase_41 AC 2 ms
4,376 KB
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
using namespace std;

int main() {
	int N, ans = 0;
	cin >> N;
	vector<bool> a(N + 1, true);
	a[0] = a[1] = false;
	for (int i = 2; i * i <= N; ++i) {
		if (a[i]) {
			for (int j = 2 * i; j <= N; j += i) a[j] = false;
		}
	}
	for (int i = 2; i * i <= N; ++i) {
		for (int j = 2; j < i * i - 1; ++j) {
			if (a[i] && a[i * i - j] && a[j]) ++ans;
		}
	}
	cout << ans;
}
0