結果

問題 No.91 赤、緑、青の石
ユーザー bluemegane
提出日時 2018-10-03 19:53:39
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 464 ms / 5,000 ms
コード長 692 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 112,460 KB
実行使用メモリ 31,300 KB
最終ジャッジ日時 2024-06-24 07:17:14
合計ジャッジ時間 7,474 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 28
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System.Linq;
using System;

public class Hello
{
    public static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        var amin = a.Min();
        var ans = amin;
        for (int i = 0; i < 3; i++) a[i] -= amin;
        ans += getAns(a);
        Console.WriteLine(ans);
    }
    public static int getAns(int[] a)
    {
        Array.Sort(a);
        var ans = 0;
        while (true)
        {
            if (a[1] == 0) { a[1]+=1; a[2] -= 2; }
            if (a[2] - 3 < 0) return ans;
            a[2] -= 3;
            a[1] -= 1;
            ans++;
            Array.Sort(a);
        }
    }
}
0