結果

問題 No.106 素数が嫌い!2
ユーザー cielciel
提出日時 2014-12-19 01:25:24
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 33 ms / 5,000 ms
コード長 170 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 20,224 KB
実行使用メモリ 9,344 KB
最終ジャッジ日時 2024-06-12 01:31:25
合計ジャッジ時間 1,440 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
9,216 KB
testcase_01 AC 32 ms
9,216 KB
testcase_02 AC 32 ms
9,216 KB
testcase_03 AC 31 ms
9,216 KB
testcase_04 AC 30 ms
9,216 KB
testcase_05 AC 32 ms
9,216 KB
testcase_06 AC 31 ms
9,216 KB
testcase_07 AC 32 ms
9,216 KB
testcase_08 AC 30 ms
9,344 KB
testcase_09 AC 30 ms
9,216 KB
testcase_10 AC 31 ms
9,216 KB
testcase_11 AC 31 ms
9,216 KB
testcase_12 AC 32 ms
9,216 KB
testcase_13 AC 30 ms
9,216 KB
testcase_14 AC 30 ms
9,216 KB
testcase_15 AC 30 ms
9,216 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:1: warning: data definition has no type or storage class
    2 | t[M+1],n,k,i;main(j){
      | ^
main.c:2:1: warning: type defaults to ‘int’ in declaration of ‘t’ [-Wimplicit-int]
main.c:2:8: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int]
    2 | t[M+1],n,k,i;main(j){
      |        ^
main.c:2:10: warning: type defaults to ‘int’ in declaration of ‘k’ [-Wimplicit-int]
    2 | t[M+1],n,k,i;main(j){
      |          ^
main.c:2:12: warning: type defaults to ‘int’ in declaration of ‘i’ [-Wimplicit-int]
    2 | t[M+1],n,k,i;main(j){
      |            ^
main.c:2:14: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | t[M+1],n,k,i;main(j){
      |              ^~~~
main.c: In function ‘main’:
main.c:2:14: warning: type of ‘j’ defaults to ‘int’ [-Wimplicit-int]
main.c:3:9: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    3 |         scanf("%d%d",&n,&k);
      |         ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | #define M 2000000
main.c:3:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    3 |         scanf("%d%d",&n,&k);
      |         ^~~~~
main.c:3:9: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:6:12: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
    6 |         n=!printf("%d\n",j);
      |            ^~~~~~
main.c:6:12: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:6:12: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:6:12: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

ソースコード

diff #

#define M 2000000
t[M+1],n,k,i;main(j){
	scanf("%d%d",&n,&k);
	for(i=2;i<=M;i++)if(!t[i])for(j=i;j<=M;j+=i)t[j]++;
	for(j=i=0;i<=n;i++)j+=t[i]>=k;
	n=!printf("%d\n",j);
}
0