結果
| 問題 |
No.48 ロボットの操縦
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-05-27 09:41:14 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,977 bytes |
| コンパイル時間 | 1,602 ms |
| コンパイル使用メモリ | 104,832 KB |
| 実行使用メモリ | 17,792 KB |
| 最終ジャッジ日時 | 2024-09-20 15:11:35 |
| 合計ジャッジ時間 | 2,507 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)
{
int x = int.Parse(Console.ReadLine());
int y = int.Parse(Console.ReadLine());
int l = int.Parse(Console.ReadLine());
int a;//xの符号変換
int b;//yの符号変換
int count = 0;
if (y < 0)//y==-
{
if (x < 0)
{
count++;
a=x * -1;
count = Kxy(count, a, l);
count++;
b=y * -1;
count = Kxy(count, b, l);
Console.WriteLine(count);
}
else//x +
{
count = Kxy(count, x, l);
count++;
b=y * -1;
count = Kxy(count, b, l);
Console.WriteLine(count);
}
if (y == 0)
{
Console.WriteLine(count);
}
}
else//y==+
{
count = Kxy(count, y, l);
if (x == 0)
{
Console.WriteLine(count);
}
if (x < 0)//x -
{
count++;
a=x * -1;
count= Kxy(count, a, l);
Console.WriteLine(count);
}
else if (x > 0)
{
count = Kxy(count, x, l);
Console.WriteLine(count);
}
}
static int Kxy(int count,int x,int l)
{
count += x / l;
if (x % l != 0)
{
count += x % l;
}
return count;
}
}
}
}