結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2017-09-06 22:42:33 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 764 ms / 5,000 ms |
コード長 | 605 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 29,056 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-06 23:56:48 |
合計ジャッジ時間 | 1,684 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <stdio.h> int main() { long long int X, Y, L, x, y; int i, j; scanf("%lld %lld %lld", &X, &Y, &L); x = X; y = Y; if (X < 0) { X = -X; } if (Y < 0) { Y = -Y; } for (i = 0; 0 < X; i++) { X -= L; //printf("X=%lld i=%d\n", X, i); } for (j = 0; 0 < Y; j++) { Y -= L; //printf("Y=%lld j=%d\n", Y, j); } if (((y > 0) || (y == 0)) && x != 0) { printf("%d\n", i+j+1); } else if (y < 0 && ((x != 0) || (x == 0))) { printf("%d\n", i+j+2); } else if (y > 0 && x == 0) { printf("%d\n", i+j); } else { printf("0\n"); } return 0; }