結果
問題 | No.48 ロボットの操縦 |
ユーザー |
|
提出日時 | 2022-06-03 15:53:58 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,393 bytes |
コンパイル時間 | 744 ms |
コンパイル使用メモリ | 110,232 KB |
実行使用メモリ | 28,092 KB |
最終ジャッジ日時 | 2024-09-21 02:19:09 |
合計ジャッジ時間 | 2,072 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 4 WA * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; namespace yukicoder { class Program { static void Main(string[] args) { //X座標 int X = int.Parse(Console.ReadLine()); //Y座標 int Y = int.Parse(Console.ReadLine()); //1命令につき最大の距離 int L = int.Parse(Console.ReadLine()); //Y座標 int a = Y / L; int b = Y % L; //X座標 int c = X / L; int d = X % L; //マイナスならプラスに変更 if (a < 0 || c < 0) { if (a < 0) { a = Y / -L; } if (c < 0) { c = X / -L; } } //回転回数 int x = 0; //回転 if((X>0&&Y>0)||(X<0&&Y>0)) { x = 1; } else if((X<0&&Y<0)||(X>0&&Y<0)|| (X == 0 && Y < 0)) { x = 2; } else if((X==0&&Y==0)|| (X == 0 && Y > 0)) { x = 0; } else if((X>0&&Y==0)||(X<0&&Y==0)) { x = 1; } int num = a + b + c + d + x; Console.WriteLine(num.ToString()); } } }