아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Exam

면접 대비

시간 제한1초메모리 제한1024 MB

요약
자신의 참/거짓 답안과 친구의 답안, 그리고 친구가 맞힌 개수 k가 주어질 때 자신이 맞힐 수 있는 최대 개수를 구한다.
난이도

보통10점 중 4점

유형
그리디, 구현, 수학, 문자열
정답자
아직 제출이 없습니다

문제

Your friend and you took a true/false exam of n questions. You know your answers, your friend's answers, and that your friend got k questions correct.

Compute the maximum number of questions you could have gotten correct.

입력

The first line of input will contain a single integer m that indicates the number datasets to follow. Each dataset begins with a single integer k. The second line in the dataset contains a string of n (1 ≤ n ≤ 1000) characters, the answers you wrote down. Each letter is either a ‘T’ or an ‘F’. The third line in the dataset contains a string of n characters, the answers your friend wrote down. Each letter is either a ‘T’ or an ‘F’. The input will satisfy 0 ≤ k ≤ n.

출력

For each dataset print, on one line, the maximum number of questions you could have gotten correct.

예제1

  1. 예제 1

    입력
    2
    3
    FTFFF
    TFTTT
    6
    TTFTFFTFTF
    TTTTFFTTTT
    
    예상 출력
    2
    9