結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2018-09-30 14:22:31 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,018 bytes |
コンパイル時間 | 2,196 ms |
コンパイル使用メモリ | 105,472 KB |
実行使用メモリ | 19,584 KB |
最終ジャッジ日時 | 2024-10-12 09:06:00 |
合計ジャッジ時間 | 3,672 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 40 WA * 6 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System.Collections.Generic; using System.Linq; using System; public class Hello { public static void Main() { var n = int.Parse(Console.ReadLine().Trim()); var t = new string('x', n); var t2 = new string('o', n); var s = t + Console.ReadLine().Trim() + Console.ReadLine().Trim() + t; var p = 0; var ans = new List<int>(); while (p <= s.Length - n) { var a = s.IndexOf(t, p); if (p >= 0) { var a2 = s.Substring(0, a) + t2 + s.Substring(a + n); ans.Add(countO(a2)); p++; } else break; } Console.WriteLine(ans.Max()); } public static int countO(string s) { var ans = 0; var count = 0; foreach (var x in s) if (x == 'o') { count++; ans = Math.Max(ans, count); } else count = 0; return ans; } }