結果
| 問題 |
No.713 素数の和
|
| コンテスト | |
| ユーザー |
makonagix
|
| 提出日時 | 2017-09-09 00:02:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 312 bytes |
| コンパイル時間 | 821 ms |
| コンパイル使用メモリ | 59,384 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-07 12:26:26 |
| 合計ジャッジ時間 | 1,368 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 6 |
ソースコード
#include <iostream>
#include <math.h>
using namespace std;
int n;
int ans;
int main() {
cin >> n;
for (int i = 2; i <= n; i++) {
bool flag = true;
for (int j = 2; j <= sqrt(i); j++) {
if (i%j != 0)continue;
else { flag = false; break; }
}
if (flag)ans += i;
}
cout << ans << endl;
return 0;
}
makonagix