結果
問題 | No.208 王将 |
ユーザー |
|
提出日時 | 2016-08-11 21:18:31 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 385 bytes |
コンパイル時間 | 230 ms |
コンパイル使用メモリ | 20,352 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 11:04:55 |
合計ジャッジ時間 | 950 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d%d%d%d", &x, &y, &x2, &y2); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #define ABS(x) ((x)>0 ? (x):-(x)) #define MAX(a,b) ((a)>(b)?(a):(b)) int main(void){ int x, y; int x2, y2; scanf("%d%d%d%d", &x, &y, &x2, &y2); if(ABS(x) == ABS(y) && ABS(x2) == ABS(y2) && ABS(x) > ABS(x2) && x/ABS(x) == x2/ABS(x2) && y/ABS(y) == y2/ABS(y2)){ printf("%d\n", ABS(x)+1); }else{ printf("%d\n", MAX(ABS(x),ABS(y))); } return 0; }