結果

問題 No.325 マンハッタン距離2
ユーザー testestesttestestest
提出日時 2016-07-10 14:42:32
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 242 bytes
コンパイル時間 624 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-21 11:46:26
合計ジャッジ時間 1,019 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 0 ms
5,376 KB
testcase_02 AC 0 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 0 ms
5,376 KB
testcase_06 AC 0 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 0 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 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 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 0 ms
5,376 KB
testcase_23 AC 1 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
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:18: warning: data definition has no type or storage class
    2 | long x,y,z,m,A,B;C,D,d;main(i){scanf("%ld%ld%d%d%d",&A,&B,&C,&D,&d);for(m=A*C<=0&B*D<=0;++i<6;x=A,A=B,B=-C,C=D,D=-x)z=(x=A>0?A:0)+(y=B>1?B:1)-d,x-=C,y-=D,m-=f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%ld",m);}
      |                  ^
main.c:2:18: warning: type defaults to ‘int’ in declaration of ‘C’ [-Wimplicit-int]
main.c:2:20: warning: type defaults to ‘int’ in declaration of ‘D’ [-Wimplicit-int]
    2 | long x,y,z,m,A,B;C,D,d;main(i){scanf("%ld%ld%d%d%d",&A,&B,&C,&D,&d);for(m=A*C<=0&B*D<=0;++i<6;x=A,A=B,B=-C,C=D,D=-x)z=(x=A>0?A:0)+(y=B>1?B:1)-d,x-=C,y-=D,m-=f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%ld",m);}
      |                    ^
main.c:2:22: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
    2 | long x,y,z,m,A,B;C,D,d;main(i){scanf("%ld%ld%d%d%d",&A,&B,&C,&D,&d);for(m=A*C<=0&B*D<=0;++i<6;x=A,A=B,B=-C,C=D,D=-x)z=(x=A>0?A:0)+(y=B>1?B:1)-d,x-=C,y-=D,m-=f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%ld",m);}
      |                      ^
main.c:2:24: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | long x,y,z,m,A,B;C,D,d;main(i){scanf("%ld%ld%d%d%d",&A,&B,&C,&D,&d);for(m=A*C<=0&B*D<=0;++i<6;x=A,A=B,B=-C,C=D,D=-x)z=(x=A>0?A:0)+(y=B>1?B:1)-d,x-=C,y-=D,m-=f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%ld",m);}
      |                        ^~~~
main.c: In function ‘main’:
main.c:2:24: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int]
main.c:2:32: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    2 | long x,y,z,m,A,B;C,D,d;main(i){scanf("%ld%ld%d%d%d",&A,&B,&C,&D,&d);for(m=A*C<=0&B*D<=0;++i<6;x=A,A=B,B=-C,C=D,D=-x)z=(x=A>0?A:0)+(y=B>1?B:1)-d,x-=C,y-=D,m-=f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%ld",m);}
      |                                ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | #define f(n)(x<1&y<1&n>z)*~(n-z)*(n-z)/

ソースコード

diff #

#define f(n)(x<1&y<1&n>z)*~(n-z)*(n-z)/2
long x,y,z,m,A,B;C,D,d;main(i){scanf("%ld%ld%d%d%d",&A,&B,&C,&D,&d);for(m=A*C<=0&B*D<=0;++i<6;x=A,A=B,B=-C,C=D,D=-x)z=(x=A>0?A:0)+(y=B>1?B:1)-d,x-=C,y-=D,m-=f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%ld",m);}
0