結果

問題 No.739 大事なことなので2度言います
ユーザー マサマサ
提出日時 2022-01-16 23:41:54
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 1,072 bytes
コンパイル時間 2,300 ms
コンパイル使用メモリ 77,580 KB
実行使用メモリ 41,356 KB
最終ジャッジ日時 2024-05-02 18:51:45
合計ジャッジ時間 4,438 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 116 ms
40,968 KB
testcase_02 AC 114 ms
41,356 KB
testcase_03 AC 106 ms
40,804 KB
testcase_04 AC 115 ms
41,116 KB
testcase_05 AC 109 ms
41,196 KB
testcase_06 WA -
testcase_07 AC 118 ms
41,200 KB
testcase_08 AC 121 ms
41,228 KB
testcase_09 AC 115 ms
41,192 KB
testcase_10 AC 96 ms
39,852 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");
        }

        sc.close();

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