結果
| 問題 |
No.172 UFOを捕まえろ
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2015-05-28 11:01:01 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 263 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 23,552 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-26 03:09:11 |
| 合計ジャッジ時間 | 1,129 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:13: warning: implicit declaration of function ‘abs’ [-Wimplicit-function-declaration]
8 | x = abs(x);
| ^~~
main.c:3:1: note: include ‘<stdlib.h>’ or provide a declaration of ‘abs’
2 | #include <math.h>
+++ |+#include <stdlib.h>
3 |
main.c:6:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d%d%d", &x, &y, &r);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main(void) {
int x, y, r, tmp;
scanf("%d%d%d", &x, &y, &r);
x = abs(x);
y = abs(y);
if(x < y){
tmp = x;
x = y;
y = tmp;
}
printf("%d\n", (int)((sqrt(y * y * 2) + r) / sqrt(2) * 2 + x - y + 1));
return 0;
}
suppy193