結果
| 問題 | No.48 ロボットの操縦 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-29 16:23:32 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 2,687 ms / 5,000 ms |
| コード長 | 1,014 bytes |
| コンパイル時間 | 4,782 ms |
| コンパイル使用メモリ | 108,572 KB |
| 実行使用メモリ | 25,944 KB |
| 最終ジャッジ日時 | 2024-11-28 22:39:18 |
| 合計ジャッジ時間 | 5,210 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Linq;
class Program
{
static void Main()
{
int X = int.Parse(Console.ReadLine());
int Y = int.Parse(Console.ReadLine());
int L = int.Parse(Console.ReadLine());
int x = 0, y = 0, dir = 0, count = 0;
if(0 < Y)
{
while(y < Y)
{
y += L;
count++;
}
}
if(X < 0)
{
count++;
while(X < x)
{
x -= L;
count++;
}
}
else if(0 < X)
{
count++;
while(x < X)
{
x += L;
count++;
}
}
else if(X == 0 && Y < 0)
{
count++;
}
if(Y < 0)
{
count++;
while(Y < y)
{
y -= L;
count++;
}
}
Console.WriteLine($"{count}");
}
}