結果

問題 No.48 ロボットの操縦
ユーザー chankou0920
提出日時 2017-10-02 12:22:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 1,013 ms
コンパイル使用メモリ 106,108 KB
実行使用メモリ 25,920 KB
最終ジャッジ日時 2024-11-15 22:40:21
合計ジャッジ時間 2,847 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18 WA * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

public class Program {
	public static void Main(string[] args) {
		long x = System.Math.Abs(long.Parse(Console.ReadLine()));
		long y = System.Math.Abs(long.Parse(Console.ReadLine()));
		long l = long.Parse(Console.ReadLine());
		long count = 0;
		
		// 前進する回数
		if (x % l == 0) {
			count += x / l;
		} else {
			count += x / l + 1;
		}
		if (y % l == 0) {
			count += y / l;
		} else {
			count += y / l + 1;
		}
		
		// 方向転換する回数
		if (y < 0) {
			count += 2;
		} else if (x != 0) {
			count += 1;
		}
		
		Console.WriteLine(count);
	}
}
0