結果

問題 No.717 ファッションへのこだわり
ユーザー htensaihtensai
提出日時 2019-11-12 00:54:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 151 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 1,907 ms
コンパイル使用メモリ 72,224 KB
実行使用メモリ 58,244 KB
最終ジャッジ日時 2023-10-13 14:53:31
合計ジャッジ時間 4,128 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 108 ms
56,016 KB
testcase_01 AC 113 ms
55,688 KB
testcase_02 AC 117 ms
56,404 KB
testcase_03 AC 114 ms
56,352 KB
testcase_04 AC 112 ms
54,212 KB
testcase_05 AC 114 ms
58,244 KB
testcase_06 AC 114 ms
55,672 KB
testcase_07 AC 141 ms
56,244 KB
testcase_08 AC 151 ms
54,336 KB
testcase_09 AC 140 ms
56,384 KB
testcase_10 AC 122 ms
56,248 KB
testcase_11 AC 138 ms
56,288 KB
testcase_12 AC 136 ms
56,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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