Logo
(追記) (追記ここまで)

13456번 - Richard Hamming 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB36132228790.823%

문제

The Hamming distance dH( ⃗v, ⃗u) between two n-dimensional vectors ⃗v = (v1, . . . , vn) and ⃗u =(u1, . . . , un) is defined as dH( ⃗v, ⃗u) = |{i : vi ≠ ui and i ∈ {1, . . . , n}}|, i.e., the number of positions at which the corresponding entries are different. For example, the Hamming distance between (1, 2, 3, 4, 5) and (1, 0, 0, 4, 5) is 2, since these two vectors differ only at the second and the third positions. Please write a program to compute the Hamming distance between two n-dimensional vectors.

입력

On the first line there is a single integer T (T ≤ 100) indicating the number of test cases. Each test case consists of three lines. The first line of each test case contains an integer n (0 < n ≤ 50) indicating the dimension of the vectors. The second line contains n integers v1, . . . , vn, and the third line contains n integers u1, . . . , un. You may assume that v1, . . . , vn, u1, . . . , un ∈ {0, 1, . . . , 99}.

출력

For each test case, output the Hamming distance between (v1, . . . , vn) and (u1, . . . , un).

제한

예제 입력 1

2
3
1 2 3
3 2 1
4
1 0 1 0
1 0 1 1

예제 출력 1

2
1

힌트

출처

ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2016 H번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /