結果

問題 No.3079 アルベド
ユーザー Shiro_SShiro_S
提出日時 2021-04-01 20:36:44
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 343 ms
コンパイル使用メモリ 29,312 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-10 06:55:26
合計ジャッジ時間 1,135 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include<stdio.h>
int p[1<<17],T,N;
int main(){
	for(int i=2;i<1<<17;i++)p[i]=1;
	for(int i=2;i<1<<17;i++){
		if(p[i]){
			for(int j=2*i;j<1<<17;j+=i)p[j]=0;
		}
	}
	for(int i=2;i<1<<17;i++)p[i]+=p[i-1];
	scanf("%d",&T);
	while(T--){
		scanf("%d",&N);
		printf("%d\n",p[N]);
	}
}
0