結果
問題 | No.713 素数の和 |
ユーザー |
|
提出日時 | 2019-08-01 00:24:11 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 423 bytes |
コンパイル時間 | 2,087 ms |
コンパイル使用メモリ | 192,100 KB |
最終ジャッジ日時 | 2025-01-07 10:23:09 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 2 WA * 4 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long ll;bool isprime(int n) {if (n < 2) return false;if (n == 2) return true;for (int i = 3; i*i <= n; i += 2) {if (n % i == 0) return false;}return true;}int main() {int n;cin >> n;int sum = 0;for (int i = 2; i <= n; i++) {if (isprime(i)) sum += i;}cout << sum << endl;return 0;}