結果

問題 No.69 文字を自由に並び替え
ユーザー packer_jppacker_jp
提出日時 2017-01-21 19:28:42
言語 Java21
(openjdk 21)
結果
AC  
実行時間 117 ms / 5,000 ms
コード長 973 bytes
コンパイル時間 3,231 ms
コンパイル使用メモリ 74,604 KB
実行使用メモリ 58,260 KB
最終ジャッジ日時 2023-08-20 23:33:55
合計ジャッジ時間 5,878 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 116 ms
56,156 KB
testcase_01 AC 117 ms
56,300 KB
testcase_02 AC 117 ms
56,096 KB
testcase_03 AC 117 ms
55,516 KB
testcase_04 AC 115 ms
55,684 KB
testcase_05 AC 115 ms
56,300 KB
testcase_06 AC 115 ms
56,184 KB
testcase_07 AC 115 ms
53,592 KB
testcase_08 AC 116 ms
55,856 KB
testcase_09 AC 116 ms
56,160 KB
testcase_10 AC 117 ms
55,944 KB
testcase_11 AC 116 ms
56,140 KB
testcase_12 AC 116 ms
55,708 KB
testcase_13 AC 114 ms
58,260 KB
testcase_14 AC 116 ms
56,052 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Practice {
    public static void main(String args[]){
        Scanner scanner=new Scanner(System.in);
        String A=scanner.next(),B=scanner.next();
        String alphabet="abcdefghijklmnopqrstuvwxyz";
        int[] Amatch=new int[alphabet.length()],Bmatch=new int[alphabet.length()];
        for(int i=0;i<alphabet.length();i++){
            Amatch[i]=0;
            Bmatch[i]=0;
        }
        for(int i=0;i<A.length();i++){
            for(int j=0;j<alphabet.length();j++){
                if(A.charAt(i)==alphabet.charAt(j)){
                    Amatch[j]++;
                }
                if(B.charAt(i)==alphabet.charAt(j)){
                    Bmatch[j]++;
                }
            }
        }
        for(int i=0;i<alphabet.length();i++){
            if(Amatch[i]!=Bmatch[i]){
                System.out.println("NO");
                return;
            }
        }
        System.out.println("YES");
    }
}
0