結果
問題 |
No.204 ゴールデン・ウィーク(2)
|
ユーザー |
![]() |
提出日時 | 2016-09-16 14:43:34 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,524 bytes |
コンパイル時間 | 2,797 ms |
コンパイル使用メモリ | 115,660 KB |
実行使用メモリ | 29,100 KB |
最終ジャッジ日時 | 2024-11-17 07:16:27 |
合計ジャッジ時間 | 3,805 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 21 WA * 25 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.IO; using System.Collections; using System.Collections.Generic; using System.Text; using System.Linq; class Template { static Scanner sc; static int D; static string c = ""; public static void Main(string[] args) { sc = new Scanner(); D = sc.nextInt(); for (int i = 0; i < 2; i++) { c += sc.next(); } int ans = 0; for (int i = 0; i < 14; i++) { ans = Math.Max(ans, func(i)); } Console.WriteLine(ans); } static int func(int d) { int res = 0; string bufs = String.Copy(c); char[] buf = bufs.ToArray(); for (int i = 0; i + d < buf.Length && i < D; i++) { if (buf[i + d] == 'o') break; buf[i + d] = 'o'; } int cnt = 0; for (int i = 0; i < buf.Length; i++) { if (buf[i] == 'o') cnt++; else { res = Math.Max(res, cnt); cnt = 0; } } res = Math.Max(res, cnt); return res; } } public class Scanner { public Scanner() { } public string next() { return Console.ReadLine(); } public int nextInt() { return int.Parse(next()); } public double nextDouble() { return double.Parse(next()); } public long nextLong() { return long.Parse(next()); } public string[] nextArray() { return next().Split(' '); } public int[] nextIntArray() { return Array.ConvertAll(nextArray(), e => int.Parse(e)); } public long[] nextLongArray() { return Array.ConvertAll(nextArray(), e => long.Parse(e)); } public double[] nextDoubleArray() { return Array.ConvertAll(nextArray(), e => double.Parse(e)); } }