提交时间:2021-05-03 14:41:39
运行 ID: 18983
#include<bits/stdc++.h> using namespace std; int n; char a[105],a1[105]; int s[105],s1[105]; int main() { cin>>n; cin>>a; cin>>a1; int sum=0; for(int i=0;i<strlen(a);i++) s[i]=a[i]-'0'; for(int i=0;i<strlen(a1);i++) s1[i]=a1[i]-'0'; for(int i=0;i<strlen(a1);i++) { if(s1[i]>s[i])sum+=s1[i]-s[i]; else if(s1[i]<s[i])sum=sum+26+s1[i]-s[i]; } cout<<sum<<endl; return 0; }