Combination Lock (UVA 13049) by aizu_e
Contest: 3738    RunID: 20173775    Status: Accepted    Date: Sat Oct 14 14:25:38 JST 2017


#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  for(int k=1;k<=n;k++){
    int size,ans=0;
    string a,b;
    cin>>size>>a>>b;
    for(int i=0;i<size;i++){
      ans+=min(abs(a[i]-b[i]),10-abs(a[i]-b[i]));
    }
    cout<<"Case "<<k<<": "<<ans<<endl;
  }
  return 0;
}