結果

問題 No.3079 アルベド
ユーザー RhoRho
提出日時 2020-04-04 15:36:26
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 142 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 1,794 ms
コンパイル使用メモリ 168,088 KB
実行使用メモリ 4,516 KB
最終ジャッジ日時 2023-08-22 18:48:51
合計ジャッジ時間 3,064 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
4,380 KB
testcase_01 AC 142 ms
4,384 KB
testcase_02 AC 87 ms
4,384 KB
testcase_03 AC 60 ms
4,380 KB
testcase_04 AC 111 ms
4,380 KB
testcase_05 AC 83 ms
4,380 KB
testcase_06 AC 102 ms
4,384 KB
testcase_07 AC 20 ms
4,384 KB
testcase_08 AC 27 ms
4,384 KB
testcase_09 AC 76 ms
4,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define int long long
typedef pair<int, int> P;
typedef pair<P, int>PP;
vector<int>primes;
int isp[100006];
void furui() {
	for (int i = 2; i <= 100000; i++) {
		if (isp[i])continue;
		primes.push_back(i);
		for (int j = i + i; j <= 100000; j+=i)isp[j] = 1;
	}
}

signed main() {
	int t; cin >> t;
	assert(1 <= t&&t <= 100000);
	furui();
	rep(i, t) {
		int n; cin >> n;
		assert(1 <= n&&n <= 100000);
		cout << (upper_bound(primes.begin(), primes.end(), n) - primes.begin()) << endl;
	}
}
0