結果
| 問題 | No.48 ロボットの操縦 |
| コンテスト | |
| ユーザー |
くれちー
|
| 提出日時 | 2016-08-06 11:09:34 |
| 言語 | C90 (gcc 12.4.0) |
| 結果 |
AC
|
| 実行時間 | 768 ms / 5,000 ms |
| コード長 | 352 bytes |
| 記録 | |
| コンパイル時間 | 117 ms |
| コンパイル使用メモリ | 29,640 KB |
| 最終ジャッジ日時 | 2026-02-23 22:12:53 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d %d %d", &x, &y, &l);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <math.h>
int main() {
int x, y, l, cnt = 0, i;
scanf("%d %d %d", &x, &y, &l);
if (y >= 0) {
if (x != 0) cnt++;
}
else cnt += 2;
for (i = 0;; i++) {
if (i*l >= abs(x)) {
cnt += i;
break;
}
}
for (i = 0;; i++) {
if (i*l >= abs(y)) {
cnt += i;
break;
}
}
printf("%d\n", cnt);
return 0;
}
くれちー