結果
| 問題 | No.279 木の数え上げ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-24 19:47:55 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 1,155 ms / 2,000 ms |
| コード長 | 803 bytes |
| 記録 | |
| コンパイル時間 | 910 ms |
| コンパイル使用メモリ | 106,112 KB |
| 実行使用メモリ | 34,560 KB |
| 最終ジャッジ日時 | 2024-09-16 04:41:26 |
| 合計ジャッジ時間 | 11,416 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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.Linq;
class Program
{
static void Main(string[] args)
{
int treeCount = 0;
var line = Console.ReadLine().ToCharArray().OrderBy(x => x == 't').ThenBy(x => x == 'r').ThenBy(x => x == 'e').ToArray();
Array.Reverse(line);
int tCnt = line.Count(x => x == 't');
int rCnt = line.Count(x => x == 'r');
int eCnt = line.Count(x => x == 'e');
if ( tCnt == 0 ||
rCnt == 0 ||
eCnt < 2)
{
Console.WriteLine(treeCount);
return;
}
int treeCnt = 0;
while (tCnt >= 1 && rCnt >= 1 && eCnt >= 2)
{
treeCnt++;
tCnt--;
rCnt--;
eCnt -= 2;
}
Console.WriteLine(treeCnt);
}
}