結果
問題 | No.279 木の数え上げ |
ユーザー | Crowea |
提出日時 | 2019-01-24 19:47:55 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 1,024 ms / 2,000 ms |
コード長 | 803 bytes |
コンパイル時間 | 737 ms |
コンパイル使用メモリ | 70,016 KB |
実行使用メモリ | 39,220 KB |
最終ジャッジ日時 | 2023-10-14 09:42:36 |
合計ジャッジ時間 | 10,741 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
23,504 KB |
testcase_01 | AC | 53 ms
23,448 KB |
testcase_02 | AC | 54 ms
23,520 KB |
testcase_03 | AC | 50 ms
23,572 KB |
testcase_04 | AC | 51 ms
23,492 KB |
testcase_05 | AC | 49 ms
21,492 KB |
testcase_06 | AC | 51 ms
21,492 KB |
testcase_07 | AC | 52 ms
21,464 KB |
testcase_08 | AC | 50 ms
21,552 KB |
testcase_09 | AC | 52 ms
21,564 KB |
testcase_10 | AC | 910 ms
36,376 KB |
testcase_11 | AC | 216 ms
26,252 KB |
testcase_12 | AC | 627 ms
33,468 KB |
testcase_13 | AC | 139 ms
22,760 KB |
testcase_14 | AC | 1,024 ms
37,616 KB |
testcase_15 | AC | 802 ms
34,688 KB |
testcase_16 | AC | 755 ms
33,460 KB |
testcase_17 | AC | 975 ms
36,460 KB |
testcase_18 | AC | 544 ms
30,892 KB |
testcase_19 | AC | 895 ms
36,096 KB |
testcase_20 | AC | 1,005 ms
39,220 KB |
ソースコード
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); } }