結果

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

テストケース

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

ソースコード

diff #

a[999999],T[999999],n,e;main(i){
	for(*a=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])a[i]=a[i-e]+1;
	}
	n=!printf("%d\n",a[n]-1);
}
0