結果
| 問題 | No.325 マンハッタン距離2 |
| コンテスト | |
| ユーザー |
testestest
|
| 提出日時 | 2016-06-30 05:53:56 |
| 言語 | C90(gcc12) (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 385 bytes |
| 記録 | |
| コンパイル時間 | 150 ms |
| コンパイル使用メモリ | 30,532 KB |
| 最終ジャッジ日時 | 2026-02-23 21:43:43 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 |
コンパイルメッセージ
main.c:1:8: warning: data definition has no type or storage class
1 | long m;x1,x2,y1,y2,d;
| ^~
main.c: In function ‘main’:
main.c:12:9: warning: incompatible implicit declaration of built-in function ‘scanf’ [-Wbuiltin-declaration-mismatch]
12 | scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&d);
| ^~~~~
main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | long m;x1,x2,y1,y2,d;
main.c:18:12: warning: incompatible implicit declaration of built-in function ‘printf’ [-Wbuiltin-declaration-mismatch]
18 | m=!printf("%ld",m);
| ^~~~~~
main.c:18:12: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’
ソースコード
long m;x1,x2,y1,y2,d;
#define max(p,q)(p>q?p:q)
#define f(n)(n>0?(n)*(n+1)/2:0)
g(p,q,r,s){
long x,y,z;
x=p-max(r,0);
y=q-max(s,1);
z=d-max(r,0)-max(s,1);
m+=x>=0&y>=0?f(z+1)-f(z-y)-f(z-x)+f(z-x-y-1):0;
}
main(){
scanf("%d%d%d%d%d",&x1,&y1,&x2,&y2,&d);
m=x1<=0&x2>=0&y1<=0&y2>=0;
g(x2,y2,x1,y1);
g(y2,-x1,y1,-x2);
g(-x1,-y1,-x2,-y2);
g(-y1,x2,-y2,x1);
m=!printf("%ld",m);
}
testestest