結果
問題 | No.91 赤、緑、青の石 |
ユーザー |
![]() |
提出日時 | 2018-10-03 19:50:11 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 460 ms / 5,000 ms |
コード長 | 736 bytes |
コンパイル時間 | 1,730 ms |
コンパイル使用メモリ | 112,552 KB |
実行使用メモリ | 22,912 KB |
最終ジャッジ日時 | 2024-06-24 07:16:26 |
合計ジャッジ時間 | 8,070 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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;if (a[1] - 1 < 0) return ans;a[1] -= 1;ans++;Array.Sort(a);}}}