結果

問題 No.713 素数の和
ユーザー aguroshouaguroshou
提出日時 2018-07-13 22:33:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 749 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 68,636 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 11:12:51
合計ジャッジ時間 1,141 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
using namespace std;
int main()
{

	//int a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, ans = 0;
	long long a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, g = 0, h = 0, i = 0, j = 0, k = 0, l = 0, ans = 0;
	//cout << LONG_MAX << endl;
	//string s[1001];
	//long long n, A[1000000000];
	long long n, m;
	//string s;
	
	cin >> n;
	for ( a = 2; a <= n; a++)
	{
		c = 0;
		for ( b = 2; b < a; b++)
		{
			if (a%b==0)
			{
				c = 1;
				break;
			}

		}
		if (c==0)
		{
			d += a;
		}
	}
	//std::cout << std::fixed;
	//cout << std::setprecision(20) << << endl;
	cout << d << endl;
	
	return 0;
}
0