結果

問題 No.717 ファッションへのこだわり
ユーザー tentententen
提出日時 2020-10-09 09:14:28
言語 Java21
(openjdk 21)
結果
AC  
実行時間 160 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 1,929 ms
コンパイル使用メモリ 71,384 KB
実行使用メモリ 56,568 KB
最終ジャッジ日時 2023-09-27 12:32:43
合計ジャッジ時間 4,453 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 112 ms
56,004 KB
testcase_01 AC 113 ms
55,784 KB
testcase_02 AC 117 ms
56,064 KB
testcase_03 AC 115 ms
55,804 KB
testcase_04 AC 110 ms
56,116 KB
testcase_05 AC 115 ms
53,956 KB
testcase_06 AC 122 ms
55,952 KB
testcase_07 AC 148 ms
56,140 KB
testcase_08 AC 147 ms
54,392 KB
testcase_09 AC 155 ms
56,244 KB
testcase_10 AC 131 ms
55,756 KB
testcase_11 AC 149 ms
56,276 KB
testcase_12 AC 160 ms
56,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int sa = 0;
        int sb = 0;
        for (char c : sc.next().toCharArray()) {
            if (c == 'A') {
                sa++;
            } else {
                sb++;
            }
        }
        int ta = 0;
        int tb = 0;
        for (char c : sc.next().toCharArray()) {
            if (c == 'A') {
                ta++;
            } else {
                tb++;
            }
        }
        System.out.println(Math.min(sa, ta) + Math.min(sb, tb));
    }
}
0