結果

問題 No.717 ファッションへのこだわり
ユーザー tenten
提出日時 2020-10-09 09:14:28
言語 Java
(openjdk 23)
結果
AC  
実行時間 164 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 2,884 ms
コンパイル使用メモリ 74,228 KB
実行使用メモリ 41,668 KB
最終ジャッジ日時 2024-07-20 06:39:58
合計ジャッジ時間 4,366 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

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