結果

問題 No.739 大事なことなので2度言います
ユーザー マサマサ
提出日時 2022-01-16 23:43:21
言語 Java21
(openjdk 21)
結果
AC  
実行時間 110 ms / 2,000 ms
コード長 1,125 bytes
コンパイル時間 2,119 ms
コンパイル使用メモリ 74,456 KB
実行使用メモリ 56,088 KB
最終ジャッジ日時 2023-08-15 06:50:51
合計ジャッジ時間 4,162 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
56,088 KB
testcase_01 AC 106 ms
55,828 KB
testcase_02 AC 109 ms
53,912 KB
testcase_03 AC 106 ms
56,088 KB
testcase_04 AC 106 ms
55,608 KB
testcase_05 AC 105 ms
56,064 KB
testcase_06 AC 110 ms
56,084 KB
testcase_07 AC 108 ms
55,356 KB
testcase_08 AC 106 ms
55,400 KB
testcase_09 AC 105 ms
55,612 KB
testcase_10 AC 109 ms
55,840 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