結果

問題 No.1412 Super Ryuo
ユーザー pengin_2000
提出日時 2021-07-14 09:22:43
言語 C
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 28,544 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-03 08:16:17
合計ジャッジ時間 650 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c:2:15: warning: conflicting types for built-in function 'abs'; expected 'int(int)' [-Wbuiltin-declaration-mismatch]
    2 | long long int abs(long long int n)
      |               ^~~
main.c:2:1: note: 'abs' is declared in header '<stdlib.h>'
    1 | #include<stdio.h>
  +++ |+#include <stdlib.h>
    2 | long long int abs(long long int n)

ソースコード

diff #

#include<stdio.h>
long long int abs(long long int n)
{
	if (n < 0)
		n *= -1;
	return n;
}
int main()
{
	long long int a, b, c, d;
	scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
	int ans = 2;
	if (a == c)ans = 1;
	if (b == d)ans = 1;
	if (abs(a - c) + abs(b - d) <= 3)ans = 1;
	printf("%d\n", ans);
	return 0;
}
0