結果

問題 No.48 ロボットの操縦
ユーザー chankou0920chankou0920
提出日時 2017-10-02 12:22:21
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 582 bytes
コンパイル時間 680 ms
コンパイル使用メモリ 110,152 KB
実行使用メモリ 26,044 KB
最終ジャッジ日時 2024-04-27 18:15:05
合計ジャッジ時間 2,249 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
24,112 KB
testcase_01 AC 19 ms
23,768 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 20 ms
25,972 KB
testcase_05 AC 19 ms
24,112 KB
testcase_06 AC 20 ms
23,772 KB
testcase_07 AC 19 ms
23,772 KB
testcase_08 WA -
testcase_09 AC 20 ms
23,768 KB
testcase_10 WA -
testcase_11 AC 20 ms
23,768 KB
testcase_12 AC 19 ms
23,780 KB
testcase_13 AC 20 ms
24,032 KB
testcase_14 AC 19 ms
23,772 KB
testcase_15 AC 21 ms
24,016 KB
testcase_16 AC 20 ms
23,680 KB
testcase_17 AC 19 ms
25,940 KB
testcase_18 WA -
testcase_19 AC 19 ms
23,772 KB
testcase_20 AC 18 ms
23,772 KB
testcase_21 AC 19 ms
23,648 KB
testcase_22 WA -
testcase_23 AC 19 ms
23,624 KB
testcase_24 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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