結果

問題 No.717 ファッションへのこだわり
ユーザー 37zigen37zigen
提出日時 2018-07-27 22:48:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 748 bytes
コンパイル時間 2,078 ms
コンパイル使用メモリ 72,040 KB
実行使用メモリ 56,576 KB
最終ジャッジ日時 2023-09-18 12:09:37
合計ジャッジ時間 4,549 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,708 KB
testcase_01 AC 123 ms
55,520 KB
testcase_02 AC 122 ms
55,220 KB
testcase_03 AC 121 ms
55,804 KB
testcase_04 AC 122 ms
55,708 KB
testcase_05 AC 124 ms
55,852 KB
testcase_06 AC 127 ms
55,440 KB
testcase_07 AC 155 ms
54,136 KB
testcase_08 AC 156 ms
56,476 KB
testcase_09 AC 157 ms
56,064 KB
testcase_10 AC 138 ms
55,488 KB
testcase_11 AC 155 ms
56,556 KB
testcase_12 AC 156 ms
56,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		new Main().run();
	}

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		String str1 = sc.next();
		String str2 = sc.next();
		int[] cnt1 = new int[2];
		int[] cnt2 = new int[2];
		for (char c : str1.toCharArray()) {
			if (c == 'A')
				++cnt1[0];
			else
				++cnt1[1];
		}
		for (char c : str2.toCharArray()) {
			if (c == 'A') {
				++cnt2[0];
			} else {
				++cnt2[1];
			}
		}
		int a = Math.min(cnt1[0], cnt2[0]);
		int b = Math.min(cnt1[1], cnt2[1]);
		System.out.println(a + b);
	}

	void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}
0