結果

問題 No.739 大事なことなので2度言います
ユーザー マサマサ
提出日時 2022-01-16 23:43:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 1,125 bytes
コンパイル時間 4,382 ms
コンパイル使用メモリ 77,372 KB
実行使用メモリ 41,800 KB
最終ジャッジ日時 2024-05-02 18:52:00
合計ジャッジ時間 4,363 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
41,024 KB
testcase_01 AC 126 ms
41,228 KB
testcase_02 AC 130 ms
41,632 KB
testcase_03 AC 123 ms
41,200 KB
testcase_04 AC 131 ms
41,412 KB
testcase_05 AC 126 ms
41,112 KB
testcase_06 AC 126 ms
41,176 KB
testcase_07 AC 134 ms
41,800 KB
testcase_08 AC 132 ms
41,452 KB
testcase_09 AC 126 ms
41,192 KB
testcase_10 AC 125 ms
41,064 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.nextLine();

        if (s.length() % 2 == 1) {
            System.out.println("NO");
            System.exit(0);
        }

        String[] a = new String[s.length() / 2];
        String[] b = new String[s.length() / 2];

        for (int i = 0; i < s.length() / 2; i++) {
            a[i] = String.valueOf(s.charAt(i));
        }

        for (int j = 0; j < s.length() / 2; j++) {
            b[j] = String.valueOf(s.charAt(s.length() / 2 + j));
        }

        int flg = 0;
        for (int k = 0; k < s.length() / 2; k++) {
          if (a[k].equals(b[k])) {
            flg += 1;
          }
        }

        if (flg == s.length() / 2) {
          System.out.println("YES");
        } else {
          System.out.println("NO");
        }

        sc.close();

        /*
        for (String v : a) {
          System.out.print(v);
        }
        System.out.println();
        for (String v : b) {
          System.out.print(v);
        }
        */
    }
}
0