結果
問題 | No.713 素数の和 |
ユーザー |
|
提出日時 | 2018-07-19 13:25:44 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 437 bytes |
コンパイル時間 | 1,309 ms |
コンパイル使用メモリ | 166,944 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 14:41:26 |
合計ジャッジ時間 | 1,822 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 6 |
ソースコード
#include "bits/stdc++.h"using namespace std;#define fastcin {\cin.tie(0);\ios::sync_with_stdio(false);\}#define rep(i, a, b) for(int i = a; i < b; i++)#define print(x) cout << x << "\n"bool p[1001];int main() {fastcin;int n, ans = 0;cin >> n;rep(i, 2, n+1) {if(!p[i]) {ans+=i;for(int j=i+i; j<n+1; j+=i) p[j] = true;}}print(ans);return 0;}