結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-05-01 23:30:01 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 274 bytes |
| コンパイル時間 | 372 ms |
| コンパイル使用メモリ | 29,312 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-28 00:15:37 |
| 合計ジャッジ時間 | 1,297 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 13 WA * 12 |
コンパイルメッセージ
main.c: In function 'main':
main.c:8:13: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
8 | t = abs(x) + abs(y);
| ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
2 | #include <math.h>
+++ |+#include <stdlib.h>
3 |
ソースコード
#include <stdio.h>
#include <math.h>
int main(void)
{
int x, y, l, s = 0, t;
scanf("%d\n%d\n%d", &x, &y, &l);
t = abs(x) + abs(y);
x != 0 ? s++ : 0;
y < 0 && x != 0 ? s++ : y < 0 ? s += 2 : 0;
s += t / l;
t%l ? s++ : 0;
printf("%d\n", s);
return 0;
}