結果

問題 No.325 マンハッタン距離2
ユーザー testestesttestestest
提出日時 2016-06-30 06:52:02
言語 C90
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 259 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 20,608 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 04:16:23
合計ジャッジ時間 872 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 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 0 ms
5,376 KB
testcase_11 AC 1 ms
5,376 KB
testcase_12 AC 0 ms
5,376 KB
testcase_13 AC 1 ms
5,376 KB
testcase_14 AC 0 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 0 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 1 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 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 0 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:25: warning: data definition has no type or storage class
    2 | long long i,x,y,z,m,A,B;C,D,d;main(i){scanf("%lld%lld%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=d-(x=A>0?A:0)-(y=B>1?B:1),x-=C,y-=D,m+=x>0|y>0?0:f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%lld",m);}
      |                         ^
main.c:2:25: warning: type defaults to ‘int’ in declaration of ‘C’ [-Wimplicit-int]
main.c:2:27: warning: type defaults to ‘int’ in declaration of ‘D’ [-Wimplicit-int]
    2 | long long i,x,y,z,m,A,B;C,D,d;main(i){scanf("%lld%lld%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=d-(x=A>0?A:0)-(y=B>1?B:1),x-=C,y-=D,m+=x>0|y>0?0:f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%lld",m);}
      |                           ^
main.c:2:29: warning: type defaults to ‘int’ in declaration of ‘d’ [-Wimplicit-int]
    2 | long long i,x,y,z,m,A,B;C,D,d;main(i){scanf("%lld%lld%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=d-(x=A>0?A:0)-(y=B>1?B:1),x-=C,y-=D,m+=x>0|y>0?0:f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%lld",m);}
      |                             ^
main.c:2:31: warning: return type defaults to ‘int’ [-Wimplicit-int]
    2 | long long i,x,y,z,m,A,B;C,D,d;main(i){scanf("%lld%lld%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=d-(x=A>0?A:0)-(y=B>1?B:1),x-=C,y-=D,m+=x>0|y>0?0:f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%lld",m);}
      |                               ^~~~
main.c: In function ‘main’:
main.c:2:31: warning: type of ‘i’ defaults to ‘int’ [-Wimplicit-int]
main.c:2:39: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    2 | long long i,x,y,z,m,A,B;C,D,d;main(i){scanf("%lld%lld%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=d-(x=A>0?A:0)-(y=B>1?B:1),x-=C,y-=D,m+=x>0|y>0?0:f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%lld",m);}
      |                                       ^~~~~
main.c:1:1: note: inc

ソースコード

diff #

#define f(n)(z+n>0?(z+n)*(z+n+1)/2:0)
long long i,x,y,z,m,A,B;C,D,d;main(i){scanf("%lld%lld%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=d-(x=A>0?A:0)-(y=B>1?B:1),x-=C,y-=D,m+=x>0|y>0?0:f(1)-f(y)-f(x)+f(x+y-1);m=!printf("%lld",m);}
0