結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
yycoder
|
| 提出日時 | 2019-12-08 23:55:26 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 455 bytes |
| コンパイル時間 | 906 ms |
| コンパイル使用メモリ | 25,088 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2025-01-02 20:31:41 |
| 合計ジャッジ時間 | 2,023 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d%d%d", &x, &y, &l);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<stdlib.h>
int main()
{
int x, y, l;
int total;
int X, Y;
int ycount, xcount;
scanf("%d%d%d", &x, &y, &l);
X = abs(x);
Y = abs(y);
if (Y%l == 0) ycount = Y / l;
else ycount = Y / l + 1;
if (X%l == 0) xcount = X / l;
else xcount = X / l + 1;
if (y >= 0)
if (x == 0) total = ycount + xcount;
else total = ycount + 1 + xcount;
else
total = 1 + xcount + 1 + ycount;
printf("%d\n", total);
return 0;
}
yycoder