結果

問題 No.717 ファッションへのこだわり
ユーザー toto6114
提出日時 2019-07-01 19:45:48
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 615 ms
コンパイル使用メモリ 70,888 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 03:16:34
合計ジャッジ時間 1,223 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,m,cntSA=0,cntSB=0,cntTA=0,cntTB=0;
  string s,t;
  cin >> n >> m >> s >> t;
  for(int i=0; i<s.size(); i++) {
      if(s[i]=='A') {
          cntSA++;
      }
      else {
          cntSB++;
      }
  }
  for(int i=0; i<t.size(); i++) {
      if(t[i]=='A') {
          cntTA++;
      }
      else {
          cntTB++;
      }
  }
  cout << min(cntSA,cntTA)+min(cntSB,cntTB) << endl;
}
0