結果
| 問題 |
No.279 木の数え上げ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-11-10 16:18:45 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
AC
|
| 実行時間 | 39 ms / 2,000 ms |
| コード長 | 922 bytes |
| コンパイル時間 | 1,108 ms |
| コンパイル使用メモリ | 110,436 KB |
| 実行使用メモリ | 30,780 KB |
| 最終ジャッジ日時 | 2025-11-10 16:18:49 |
| 合計ジャッジ時間 | 2,950 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
class Program
{
static void Main(string[] args)
{
char[] inputWord = Console.ReadLine()!.ToCharArray();
int tCount = 0;
int eCount = 0;
int rCount = 0;
int treeCount = 0;
foreach (char c in inputWord)
{
if (c == 't')
{
tCount++;
}
else if (c == 'e')
{
eCount++;
}
else if (c == 'r')
{
rCount++;
}
if (tCount >= 1 && eCount >= 2 && rCount >= 1)
{
treeCount++;
tCount--;
eCount -= 2;
rCount--;
}
}
Console.WriteLine(treeCount);
}
}