結果

問題 No.458 異なる素数の和
ユーザー cielciel
提出日時 2016-12-09 01:06:39
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 222 bytes
コンパイル時間 155 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 05:38:01
合計ジャッジ時間 1,033 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 AC 10 ms
5,376 KB
testcase_02 AC 11 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 25 ms
5,376 KB
testcase_06 AC 10 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 24 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 0 ms
5,376 KB
testcase_11 AC 28 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 0 ms
5,376 KB
testcase_14 AC 1 ms
5,376 KB
testcase_15 AC 0 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 0 ms
5,376 KB
testcase_18 AC 0 ms
5,376 KB
testcase_19 AC 0 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 0 ms
5,376 KB
testcase_24 AC 0 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 10 ms
5,376 KB
testcase_28 AC 28 ms
5,376 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 7 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:1:1: warning: data definition has no type or storage class
    1 | a[99999],T[99999],n,e;main(i){
      | ^
main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘a’ [-Wimplicit-int]
main.c:1:10: warning: type defaults to ‘int’ in declaration of ‘T’ [-Wimplicit-int]
    1 | a[99999],T[99999],n,e;main(i){
      |          ^
main.c:1:19: warning: type defaults to ‘int’ in declaration of ‘n’ [-Wimplicit-int]
    1 | a[99999],T[99999],n,e;main(i){
      |                   ^
main.c:1:21: warning: type defaults to ‘int’ in declaration of ‘e’ [-Wimplicit-int]
    1 | a[99999],T[99999],n,e;main(i){
      |                     ^
main.c:1:23: warning: return type defaults to ‘int’ [-Wimplicit-int]
    1 | a[99999],T[99999],n,e;main(i){
      |                       ^~~~
main.c: In function ‘main’:
main.c:1:23: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int]
main.c:2:18: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    2 |         for(*a=1,scanf("%d",&n),e=2;e<=n;e++)if(!T[e]){
      |                  ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | a[99999],T[99999],n,e;main(i){
main.c:2:18: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
    2 |         for(*a=1,scanf("%d",&n),e=2;e<=n;e++)if(!T[e]){
      |                  ^~~~~
main.c:2:18: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
main.c:7:12: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
    7 |         n=!printf("%d\n",a[n]-1);
      |            ^~~~~~
main.c:7:12: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
main.c:7:12: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
main.c:7:12: note: include ‘<stdio.h>’ or p

ソースコード

diff #

a[99999],T[99999],n,e;main(i){
	for(*a=1,scanf("%d",&n),e=2;e<=n;e++)if(!T[e]){
		for(i=e+e;i<=n;i+=e)T[i]=1;
		for(i=n;i>=e;i--)if(a[i-e]&&a[i]<=a[i-e]+1)a[i]=a[i-e]+1;
	}
if(n>20000)return 1;
	n=!printf("%d\n",a[n]-1);
}
0