結果

問題 No.290 1010
ユーザー akichi
提出日時 2017-08-25 01:20:19
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 130 ms / 5,000 ms
コード長 510 bytes
コンパイル時間 841 ms
コンパイル使用メモリ 103,168 KB
実行使用メモリ 24,704 KB
最終ジャッジ日時 2024-10-15 14:27:11
合計ジャッジ時間 2,876 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
class Program {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        string s = Console.ReadLine();
        int maxW = n / 2;
        for (int w = 1; w <= maxW; w++) {
            int tmp = n - 2 * w;
            for (int i = 0; i <= tmp; i++) {
                if (s.Substring(i, w) == s.Substring(i + w, w)) {
                    Console.WriteLine("YES");
                    return;
                }
            }
        }
        Console.WriteLine("NO");
    }
}
0