結果
問題 |
No.91 赤、緑、青の石
|
ユーザー |
![]() |
提出日時 | 2018-10-03 19:52:42 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 466 ms / 5,000 ms |
コード長 | 688 bytes |
コンパイル時間 | 2,593 ms |
コンパイル使用メモリ | 111,816 KB |
実行使用メモリ | 31,308 KB |
最終ジャッジ日時 | 2024-06-24 07:16:36 |
合計ジャッジ時間 | 7,062 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.
ソースコード
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]++; a[2] -= 2; } if (a[2] - 3 < 0) return ans; a[2] -= 3; a[1]--; ans++; Array.Sort(a); } } }