| 记录编号 | 
        576557 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        3759.数字对数 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         ムラサメ | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.275 s  | 
    
    
        | 提交时间 | 
        2022-10-12 06:32:16 | 
        内存使用 | 
        4.71 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include<bits/stdc++.h>
using namespace std;
void work(){
	priority_queue<int>q1,q2;
	int n,tmp,ans=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>tmp;
		q1.push(tmp);
	}
	for(int i=1;i<=n;i++){
		cin>>tmp;
		q2.push(tmp);
	}
	while(q1.size()||q2.size()){
		if(q1.top()==q2.top()){
			q1.pop();
			q2.pop();
			continue;
		}
		if(q1.top()>q2.top()){
			q1.push(to_string(q1.top()).size());
			q1.pop();
		}
		else{
			q2.push(to_string(q2.top()).size());
			q2.pop();
		}
		ans++;
	}
	cout<<ans<<endl;
}
int main(){
	freopen("numlg.in","r",stdin);
	freopen("numlg.out","w",stdout);
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int t;
	cin>>t;
	while(t--){
		work();
	}
	return 0;
}