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

15347번 - Column Addition 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB439936.000%

문제

A multi-digit column addition is a formula on adding two integers written like this:

 123
 + 456
-------
 579

A multi-digit column addition is written on the blackboard, but the sum is not necessarily correct. We can erase any number of the columns so that the addition becomes correct. For example, in the following addition, we can obtain a correct addition by erasing the second and the forth columns.

 12127 117
 + 45618 ⇒ + 468
--------- ------- 
 51825 585

Your task is to find the minimum number of columns needed to be erased such that the remaining formula becomes a correct addition.

입력

There are multiple test cases in the input. Each test case starts with a line containing the single integer n, the number of digit columns in the addition (1 ≤ n ≤ 1000). Each of the next 3 lines contain a string of n digits. The number on the third line is presenting the (not necessarily correct) sum of the numbers in the first and the second line. The input terminates with a line containing “0” which should not be processed.

출력

For each test case, print a single line containing the minimum number of columns needed to be erased.

제한

예제 입력 1

3
123
456
579
5
12127
45618
51825
2
24
32
32
5
12299
12299
25598
0

예제 출력 1

0
2
2
1

힌트

출처

ICPC > Regionals > Asia West Continent > Iran > Tehran Site 2017 H번

  • 문제의 오타를 찾은 사람: holenet
(追記) (追記ここまで)

출처

대학교 대회

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

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