結果

問題 No.149 碁石の移動
ユーザー mencotton
提出日時 2018-02-18 12:16:02
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 29 ms / 2,000 ms
コード長 727 bytes
コンパイル時間 837 ms
コンパイル使用メモリ 110,648 KB
実行使用メモリ 27,244 KB
最終ジャッジ日時 2024-06-24 12:42:30
合計ジャッジ時間 2,046 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 13
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Linq;

namespace _149
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] b = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (x[0] < a[1])
            {
                a[1] -= x[0];
                b[1] += x[0];
            }
            else
            {
                b[1] += a[1];
                b[0] += x[0] - a[1];
                a[0] -= x[0] - a[1];
                a[1] = 0;
            }
            Console.WriteLine(a[0] + Math.Min(b[0],x[1]));
        }
    }
}
0