結果
| 問題 |
No.208 王将
|
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2017-02-04 14:18:13 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 417 bytes |
| コンパイル時間 | 144 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-24 06:14:33 |
| 合計ジャッジ時間 | 1,143 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%d %d %d %d", &x, &y, &x2, &y2);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#define rep(i, n) for (i = 0; i < n; i++)
#define max(a, b) (a > b ? a : b)
#define sign(a) (a == 0 ? 0 : (a > 0 ? 1 : -1))
int main() {
int x, y, x2, y2;
scanf("%d %d %d %d", &x, &y, &x2, &y2);
int ans = max(x, y);
if (x == y && x2 == y2 &&
abs(x2) < abs(x) && abs(y2) < abs(y) &&
sign(x) == sign(x2) && sign(y) == sign(y2)) ans++;
printf("%d\n", ans);
return 0;
}
くれちー