結果
| 問題 |
No.172 UFOを捕まえろ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-10-02 03:19:49 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 28 ms / 5,000 ms |
| コード長 | 1,083 bytes |
| コンパイル時間 | 2,912 ms |
| コンパイル使用メモリ | 112,292 KB |
| 実行使用メモリ | 26,604 KB |
| 最終ジャッジ日時 | 2024-11-21 12:52:08 |
| 合計ジャッジ時間 | 3,464 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
class Program
{
static void Main(string[] args)
{
//var data = "-50 -40 30";
var data = Console.ReadLine();
var expect = 133;
Action<string> nullFunc = (msg) => { };
Action<string> outDebug = Console.WriteLine;
//Action<string> output = outDebug;
Action<string> output = nullFunc;
var tbl = new Dictionary<bool, string>
{
{ true, "〇" },
{ false, "×" }
};
//var ret = tbl[expect == Solve(data)];
//outDebug(ret);
Console.WriteLine(Solve(data));
//Console.ReadLine();
}
static int Solve(string data)
{
var e = data.Split(' ');
var x = Math.Abs(int.Parse(e[0]));
var y = Math.Abs(int.Parse(e[1]));
var r = int.Parse(e[2]);
// UFOの最も遠いマンハッタン距離は?
var s = x + y + (int)Math.Ceiling(Math.Sqrt(2)*r);
return s;
}
}