結果
問題 |
No.48 ロボットの操縦
|
ユーザー |
![]() |
提出日時 | 2025-03-07 10:12:57 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 764 bytes |
コンパイル時間 | 590 ms |
コンパイル使用メモリ | 24,832 KB |
実行使用メモリ | 8,612 KB |
最終ジャッジ日時 | 2025-03-07 10:13:14 |
合計ジャッジ時間 | 3,059 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 5 WA * 20 |
ソースコード
#include <stdio.h> #include <stdbool.h> void main(){ //X座標 int x = 0; int inputX = scanf("%d\n",&x); if(inputX == 2){ printf("Xの入力ミス\n"); } //Y座標 int y = 0; int inputY = scanf("%d\n",&y); if(inputY == 2){ printf("Yの入力ミス\n"); } //移動距離 int l = 0; int inputL = scanf("%d\n",&l); if(inputL == 2){ printf("Lの入力ミス\n"); } //命令回数 int instructionCount = 0; //現在位置 int trueX = 0 , trueY = 0; if( y < 0){ instructionCount += 2; y *= -1; }else if(x != 0){ instructionCount += 1; } while(x >= 0 || y >= 0){ if(y >= 0){ y -= l; instructionCount ++; continue; } if(x >= 0){ x -= l; instructionCount ++; continue; } } printf("%d\n",instructionCount); }