#46365: C++ AC


1121228@stu.wghs.tp.edu.tw (你知道我是誰嗎!!??)

學校 : 臺北市私立薇閣高級中學
編號 : 266561
來源 : [60.248.154.139]
最後登入時間 :
2025-08-21 12:45:57

#include <bits/stdc++.h>

using namespace std;
int main(){
    int n;
    cin >> n;
    while (n--){
        int m=0;
        string s, t;
        cin >> s >> t;
        if(s.length()>t.length()) swap(s, t);
        for(int i=s.length()-1; i>=0; i--){
            if(s[i]-'0'+t[i]-'0'>=10){
                m++;
                if(i!=0){
                    s[i-1]++;
                }
            }
        }
        cout << m << endl;
    }
    return 0;
}