結果

問題 No.3079 アルベド
ユーザー Shiro_SShiro_S
提出日時 2021-04-01 20:36:44
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 18 ms / 2,000 ms
コード長 279 bytes
コンパイル時間 849 ms
コンパイル使用メモリ 27,996 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-23 01:32:57
合計ジャッジ時間 1,847 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
4,380 KB
testcase_01 AC 18 ms
4,380 KB
testcase_02 AC 11 ms
4,376 KB
testcase_03 AC 8 ms
4,380 KB
testcase_04 AC 14 ms
4,376 KB
testcase_05 AC 11 ms
4,380 KB
testcase_06 AC 13 ms
4,380 KB
testcase_07 AC 4 ms
4,384 KB
testcase_08 AC 5 ms
4,376 KB
testcase_09 AC 11 ms
4,380 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