結果
問題 |
No.410 出会い
|
ユーザー |
![]() |
提出日時 | 2016-08-16 01:10:53 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 315 bytes |
コンパイル時間 | 220 ms |
コンパイル使用メモリ | 22,656 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 11:06:35 |
合計ジャッジ時間 | 902 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 19 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:14:17: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration] 14 | r = min(abs(px - qx), abs(py - qy)) | ^~~ main.c:3:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’ 2 | #include <math.h> +++ |+#include <stdlib.h> 3 | main.c:12:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d %d %d %d", &px, &py, &qx, &qy); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <math.h> int min(int arg1, int arg2) { return (arg1 < arg2) ? arg1 : arg2; } int main() { int px, py, qx, qy; double r; scanf("%d %d %d %d", &px, &py, &qx, &qy); r = min(abs(px - qx), abs(py - qy)) + abs(abs(px - qx) - abs(py - qy)) / 2.0; printf("%.1lf", r); return 0; }